河南成教 / 面向对象程序设计
10[应用题]
以下程序的功能是将一个字符串的内容颠倒过来。
#include//或 #include
#include
void main()
{
int i, max;
char ch;
char str[]="1234567";
for(i=0,j=strlen(str)-1;[<>];[])
{
ch=str[i];
[];
str[j]=ch;
}
printf("%s
", str); //或 cout<<><>
}
10[应用题]
以下程序的功能是将一个字符串的内容颠倒过来。
#include
#include
void main()
{
int i, max;
char ch;
char str[]="1234567";
for(i=0,j=strlen(str)-1;[<>
{
ch=str[i];
[
str[j]=ch;
}
printf("%s
", str); //或 cout<<><>
}
参考答案:
佳题速递: