uj5u.com熱心網友回復:
// 單詞加密:使用指標方式,將任意單詞的第一個字母移到該單詞的末尾,再加上"ay"。
#include <stdio.h>
#include <stdio.h>
int main()
{
char first_c, str[100], *p;
scanf("%s", str);
p = str;
first_c = *p++; //保存第一個字符
for ( ; *p!='\0'; p++ )
{ *(p-1) = *p;
}
*(p-1) = first_c; //將第一個字符移到最后
strcpy(p, "ay"); //拼接后綴ay
printf("%s", str);
return 0;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/53585.html
標籤:C語言
上一篇:C51單片機
下一篇:救救孩子
