注意:此页面搜索的是所有试题
[应用题,25分] #include
# include
void fun(char *w,int m)
{char s,*p1,*p2;
p1=w;
p2=w+m-1;
while(p1<>
{
s=*p1;*p1=*p2;*p2=s;
p1++;
p2--;
}
}
main()
{
char a[10]="abcdefghi";
char *p=new char[10];
strcpy(p,"student");
cout<<"compare:"<<>
if(strcmp(a,p)==0)
cout<<"a == p"<<>
if(strcmp(a,p)>0)
cout<<"a > p"<<>
if(strcmp(a,p)<0)
cout<<"a < p"<<>
cout<<"before:\n";
cout<<><>
cout<<><>
cout<<"call fun"<<>
fun(a,strlen(a));
fun(p,strlen(p));
cout<<"after:\n";
cout<<><>
cout<<><>

}
程序运行结果为:

参考答案