includeiostream.hvoid main(){int n;cinn;cin.get();char s[n];cin.getline(s,n);coutsendl;delete s;}

include<iostream.h>

void main()

{

int n;

cin>>n;

cin.get();

char s[n];

cin.getline(s,n);

cout<<s<<endl;

delete s;

}


相关考题:

有以下程序include stdio.hint fun(char s[]){ int n=0;while(*s='9'stdio.hint fun(char s[]){ int n=0;while(*s='9'*s='0') {n=10*n+*s-'0';s++;}return(n);}main(){ char s[10]={ '6', '1', '*', '4', '*', '9', '*', '0', '*'};printf("%d\n",fun(s));}程序运行的结果是A ) 9B ) 61490C ) 61D ) 5

有下列程序: include include "string.h" void tim(char *s[],int n) 有下列程序: #include <stdio.h> #include "string.h" void tim(char *s[],int n) { char *t;int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])) {t=s[i];s[i]=s[j];s[j]=t;} } main() { char *ss[]= {"bcc","bbcc","xy","aaaacc","aabcc"}; fun(ss,5);printf("%s,%s\n",ss[0],ss[4]); } 程序的运行结果是( )。A.xy,aaaaccB.aaaacc,xyC.bcc,aabccD.aabcc,bcc

以下程序的执行结果是______。 include class Sample { int n; public: Sample() {} 以下程序的执行结果是______。include<iostream.h>class Sample{int n;public:Sample() {}Sample (int i (n=i;)void add (Sample s1,Sample s2){this->n=sl.n+=s2.n;}void disp() {cout<<" n="<< n <<end1:}}void main ()

有以下程序: include using namespace std; constxntN=5; int fun(char*s,char a,int 有以下程序:include <iostream>using namespace std;const xnt N=5;int fun(char *s,char a,int n){int j;*s=a;j=n;while(a<s[j])j--;return j;}int main(){char s[N+1];int k;

下列给定程序中,函数fun()的功能是:在字符串的最前端加入n个*号,形成新串,并且覆盖原串。注意:字符串的长度最长允许79。请改正函数fun()中的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。试题程序;include <stdio.h>include <strzng.h>include <conio.h>/*****************found***************/void fun(char s[], int n){char a[80],*p;int i;/*****************found***************/s=p;for(i=0; i<n; i++) a[i]='*';do{a[i]=*p;/*****************found***************/i++;}while(*p);a[i]=0;strcpy(s,a);}main(){ int n;char s[80];clrscr();printf("\nEnter a string:");gets(s);printf("\nThe string\%s\n",s);printf("\nEnter n(number of*):");scanf ("%d",n);fun(s,n);printf("\nThe string after inster: \%s\n",s);}

若有以下调用语句,则不正确的fun函数的首部是______。 main() { …… int a[50],n; fun(n,a[9]); …… }A.void fun(int m, int x[])B.void fun(kit s, kit h[41])C.void fun(kit p, kit *s)D.void fun(int n, int a)

有以下程序 include int fun(char s[]) { int n=O; whil 有以下程序 #include <stdio.h> int fun(char s[]) { int n=O; while(*s<='9'*s>='0') { n=10*n+*s-'0'; s++; } return (n); } main() { char s[10]={ '6', '1', '*', '4', '*', '9', '*', '0', '*'}; printf("%d\n",fun(s)); }A.9B.61490C.61D.5

有以下程序 include include void fun(char s[][10],int n 有以下程序 #include <stdio.h> #include <string.h> void fun(char s[][10],int n) { char t; int i j; for (i=0; i<n-1; i++) for 0--i+l; j<n; j++) /*比较字符串的首字符大小,并交换字符串的首字符*/ if(s[i][0] > s[j][0]) { t = s[i][0]; s[i][0] = s[j][0]; s[j][0] = t;} } main() { char ss[5][10]= {"bcc", "bbcc", "xy", "aaaacc", "aabcc" }; fun(ss, 5); printf("%s,%s\n", ss[0],ss[4]); } 程序的运行结果是A.xy, aaaaccB.aaaacc,xyC.xcc,aabccD.acc,xabcc

有以下程序:includeincludevoid fun(char*s[],int n){char*t;int i,j;for( 有以下程序: #include<stdio.h> #include<string.h> void fun(char*s[],int n) { char*t;int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])){t=s[i];s[i]=s[j];s[j]=t;} } main() { Char*ss[]={"bcc","bbcc","xy","aaaacc","aabcc"}; fun(ss,5);printf("%s,%s\n",ss[0],ss[4]); } 程序的运行结果是( )。A.xy,aaaaccB.aaaacc,xyC.bcc,aabccD.aabcc,bcc

有以下程序includeintfun(chars[]){intn=0;while(*s='0'){n=10*n+* 有以下程序 #include <stdio.h> int fun(char s[]) { int n=0; while(*s<='9'*s>='0') {n=10*n+*s-'0';s++;} return(n); } main() {char s[10]={'6','1','*','4','*','9','*','0','*'}; printf("%d\n",fun(s)); } 程序的运行结果是A.9B.61490C.61D.5

若有以下程序:includeusing namespace std;class sample{private:int n;public:sampl 若有以下程序: #include<iostream> using namespace std; class sample { private: int n; public: sample(){} sample(int m) { n=m; } void addvalue(int m) { sample s; s.n=n+m; *this=s; } void disp() { cout<<"n"=<<n<<end1; } }; int main() { sample s(10); s.addvalue(5); s.disp(); return 0; } 程序运行后的输出结果是A.n=10B.n=5C.n=15D.n=20

有以下程序includeincludevoidfun(char*s[],intn){char*t;int i,j;for(i=0 有以下程序 #include <stdio.h> #include <string.h> void fun(char *s[],int n) { char *t; int i,j; for(i=0;i<n-1;++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])) {t=s[i];s[i];s[j];s[j]=t;} } main() { char *ss[]={"bccA.xy,aaaaccB.aaaacc,xyC.bcc,aabccD.aabcc,bcc

下列程序中的this指针的作用是【 】。include class Sample{int n;static int st;publ 下列程序中的this指针的作用是【 】。include <iostream. h>class Sample{int n;static int st;public,Sample() {}Sample(int m) {n=m; st=m+10;}void Change(int k) {st=st+k;}void AddValue(int m){Sample s,s. n=n+m;*this=s;}void disp( ) {cout<<"n="<<n<<";st="<<st<<end1;}};int Sample: :st=0void main(){Sample s1(10),s2(10)s1.disp()s1.AddValue(5),s2.Change(100);s1.disp();s2.disp()}

以下程序运行后输入:3,abcde回车,则输出结果是【 】include move(char *str, 以下程序运行后输入:3,abcde回车,则输出结果是【 】include <string.h>move(char *str, int n){ char temp; int i;temp=str[n-1];for(i=n-1;i>0;i--) str[i]=str[i-1];str[0]=temp;}main( ){ char s[50]; int n, i, z;scanf("%d,%s",n,s);z=strlen(s);for(i=1; i<=n; i++) move(s, z);printf("%s\n",s);}

若有以下调用语句,则不正确的fun函数的首部是( )。 main() { … int a[50],n; … fun(n,a[9]); … }A.void fun(int m,int x[])B.void fun(int s,int h[41])C.voidfun(int p,int*s)D.void fun(int n,iht a)

有以下程序 #includestdio.h int fun(char s[]) {int n=0; while(*s=9&&*s=0){n=10*n+*s-o;s++;) return(n); } main {char s[10]={6,1,*,4,*,9,*, 0,*); printf("%d",fun(s)); } 程序运行的结果是( )。A.9B.61490C.61D.5

假定n=3,,下列程序的运行结果是()。includeint Fun(int m)void main(){cout 假定n=3,,下列程序的运行结果是( )。 #include<iostream.h> int Fun(int m) void main() { cout<<"Please input a number:"; int n,s=0; cin>>n; s=Fun(n); cout<<s<<endl; } int Fun(int m) { iht p=1,s=0; for (int I=1;I<=m;I++) { p*=I; S+=p; } return s; }A.7B.9C.8D.10

有以下程序includevoid main(){char s[]={"01aXy"};int i,n=0;for(i=0;s[i]!=0;i++)if 有以下程序 #include<stdio.h> void main() { char s[]={"01aXy"};int i,n=0; for(i=0;s[i]!=0;i++) if(s[i]<='a's[i]>='z')n++; printf("%d\n",n); } 程序运行后的输出结果是( )。A.0B.2C.3D.5

有以下程序:includeinclude"string.h"void fun(char*s[],int n){char*t;int i,j;for( 有以下程序: #include<stdio.h> #include"string.h" void fun(char*s[],int n) { char*t;int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])){t=s[i];s[i]=s[j];s[j]=t;} } main() { char*ss[]={"bee","bbcc","xy","aaaacc","aabcc"}; fun(ss,5);printf("%s,%s\n",ss[0],ss[4]); } 程序的运行结果是( )。A.xy,aaaaccB.aaaacc,xyC.bcc,aabccD.aabcc,bcc

若有以下程序: #include 〈iostream〉 using namespace std; class sample { private: int n; public: sample(){} sample(int m) { n=m; } void addvalue(int m) { sample s; s.n=n+m; *this=s; } void disp() { cout〈〈"n="〈〈n〈〈end1; } }; int main() { sample s(10); s.addvalue(5); s.disp(); return 0; } 程序运行后的输出结果是( )。A.n=10B.n=5C.n=15D.n=20

有以下程序 include int fun(char s[ ]) { int n=0; while(*s='0 有以下程序#include <stdio.h>int fun(char s[ ]){ int n=0;while(*s<='9'*s>='0') {n=10*n+*s-'0';s++;}retum(n);}main( ){ char s[10]={'6','1','*','4','*','9','*','0','*'};printf("%d\n",fun(s));}程序的运行结果是A.9B.61490C.61D.5

若有以下调用语句,则不正确的 fun 函数的首部是( )。 void main() { int a[50],n; fun(n,a[9]); }A.void fun(int m,int x[])B.void fun(int s,int h[])C.void fun(intp,int * s)D.void fun(int n,int a)

有以下程序includeincludevoidfun(char,*s[],intn){char*t;inti,j; for(i= 有以下程序 #include <stdio.h> #include <string.h> void fun(char,*s[],int n) { char *t; int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])) {t=s[i];s[i]:s[j];s[j]=t;} } main() { char *ss[]={"bcc","bbcc","xy","aaaacc","aabcc"}; fun(ss,5); printf("%s,%s\n",ss[0],ss[4]); } 程序的运行结果是A.xy,aaaaccB.aaaacc,xyC.bcc,aabccD.aabcc,bcc

有以下程序:includeint fun(char s[]){ intn=0;while(*s='0'){n=10 有以下程序: #include <stdio.h> int fun(char s[]) { int n=0; while(*s<='9'*s>='0') {n=10*n+*s-'0';s++;} return(n); } main() { char s[10]={'6','1','*','4','*','9','*','0','*'}; printf("%d\n",fun(s)); } 程序的运行结果是( )。A.9B.61490C.61D.5

若有以下调用语句,则不正确的fun函数的首部是( )。 main() { int a[50],n; fun(n,a[9]); ┆ }A.void fun(int m,int x[])B.void fun(int s,int h[41])C.void fun(int p,int *s)D.void fun(int n,int a)

下列程序段的执行结果为()。includeusing namespace std;class example{int n;public: 下列程序段的执行结果为( )。 #include<iostream> using namespace std; class example{ int n; public: example(int i){n=i;} void add(){s+=n;} static int s; void pr(){ cout<<s<<endl; } }; int example::s=0; int fuc(char *x); int main(){ example x(2),y(3),z(4); x. add(); y. add(); z.pr(); return 0; }A.2B.3C.5D.6

单选题有以下程序#include int fun(char s[]){ int n=0; while(*s='0') {  n=10*n+*s-'0';  s++; } return (n);}main(){ char s[10]={'6','1','*','4','*','9','*','0','*'}; printf("%d",fun(s));}程序的运行结果是(  )。A61490B61C9D5