0 of 1 Questions completed
Questions:
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
0 of 1 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
#include <cstdio> #include <cstring> void Swap(char &a, char &b){ char temp; temp=a; a=b; b=temp; } void work(char *str){ int len=strlen(str); for (int i = 0; i < len/2; i++) { Swap(str[i],str[len-i-1]); } } int main (){ char s[100]; char *str=s; gets(s); // gets function reads a line from stdin and stores it into the string work(str); printf("%s",s); return 0; } |
程序输入字符串”hello,world!”,输出为