請問如何用c語言將單詞串逆序輸出 將I am a student變為student a am I,感謝

2021-04-20 05:38:12 字數 1528 閱讀 1953

1樓:

#include

#include

/*函式功能:

將字串 str 中的單詞,逆序輸出到 buffer 中*/char *reversewords(char str,char buffer)

else

}buffer[length]='\0';

return buffer;

}int main(int argc, char *argv);printf("%s\n",reversewords(str,buffer));

return 0;}

2樓:

儘管已有了推薦答案,但還是給

你一個作參考…

回…#include "stdio.h"//#include "ctype.h"

void main(void)

for(j--;j>=0;j--) printf("%s ",words[j]);

printf("\n");}

3樓:搶佔橋頭堡

char sztemp[100];

scanf("%s",sztemp);

int i;

for(i = strlen(sztemp);i>=0;i--)}//沒有

bai測試,du直接寫

zhi的dao,只提

版供思路權

4樓:寂寞而莫我知也

#include

#include

#define num 20

void main()

例如輸入 i am a student,則輸出 student a am i(c語言實現) 10

5樓:飛一般

最簡單方法,定義一個陣列,並賦值,然後從後往前輸出

6樓:玄之又玄

#include

#include

#include

using namespace std;

char str[1000][100];

int main()

return 0;

}若滿意請採納

c語言的輸入 i am a student輸出 i am student

7樓:

儲存到陣列裡面去,比較連續3個字元啊,當遇到' a '時候給刪掉' a'或者'a '就行了

8樓:匿名使用者

初學者應該

來是源這樣編寫

#include

main()

如果是bai迴圈輸出

du,zhi應該是這樣的

dao。

#include

#include

main()

9樓:匿名使用者

#include

#include

int main()

如何用python語言獲得字串的逆序字串

s abcdef s 1 編寫一個python程式,提示使用者輸入一個字串,程式以逆序顯示該字串。250 enter a string str hello,world the reversed string is str 1 7 10 字串逆序 python計算機程式設計題 a input prin...

C語言如何將截斷一半,C語言如何將檔案截斷一半

截斷一個陣列的一部分相當於取得一個陣列的某一個子集陣列。如果是字元陣列,可以使用strncpy函式,根據需要擷取需要部分。strncpy 是 c語言的庫函式之一,來自 c語言標準庫,定義於 string.h,char strncpy char dest,char src,int n 把src所指字串...

如何用c語言在linu下通過socket實現建立服務

不用多執行緒 最簡單的服務端用個while死迴圈就行了。給你一個 epoll模型的。傳不上去 你留個 在linux下用c語言寫個socket,一個伺服器,十個客戶端。多給點分,寫完就給你貼上來 伺服器用多執行緒,lpthread,其他的不說了linux和windows都可以的自己修改下,不用c 就用...