c語言輸入一段英文把英文的每個英文字單獨印成一行

2009-03-24 1:49 am
輸入一段英文把英文的每個英文字單獨印成一行

ex:this is a book

輸出:
this
is
a
book

回答 (3)

2009-03-28 9:17 am
✔ 最佳答案
char buf[] ="This a sample string.";

char *tok_string = " ";
char *token = strtok(buf, tok_string);
while( token != NULL ){
printf("%s\n", token);
token = strtok(NULL, tok_string);
}
2009-03-25 5:43 am
You can use stktok().
2009-03-24 3:18 am
課本就有...


收錄日期: 2021-04-30 13:07:02
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20090323000010KK06720

檢視 Wayback Machine 備份