[問題] C語言Getchar算字數
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
Codeblock10.5 C語言
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
None
問題(Question):
算字數無反應
餵入的資料(Input):
123abcd
預期的正確結果(Expected Output):
7
錯誤結果(Wrong Output):
無反應
程式碼(Code):(請善用置底文網頁, 記得排版)
#include <stdio.h>
main( )
{
long nc;
nc=0;
while (getchar()!=EOF);
++nc;
printf("%ld characters\n",nc);
}
補充說明(Supplement):
有爬過文 有類似的 有Google過
http://www.programmer-club.com.tw/ShowSameTitleN/c/14550.html
有人使用dev-c++執行也不行
初學C不好意思 請各位大大幫忙解答 謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.248.151.155
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1465491235.A.321.html
→
06/10 00:55, , 1F
06/10 00:55, 1F
推
06/10 01:11, , 2F
06/10 01:11, 2F
→
06/10 02:21, , 3F
06/10 02:21, 3F
推
06/10 09:32, , 4F
06/10 09:32, 4F
→
06/10 09:46, , 5F
06/10 09:46, 5F
→
06/10 10:08, , 6F
06/10 10:08, 6F
→
06/10 10:09, , 7F
06/10 10:09, 7F
→
06/10 10:09, , 8F
06/10 10:09, 8F
→
06/10 10:13, , 9F
06/10 10:13, 9F
→
06/10 10:14, , 10F
06/10 10:14, 10F
→
06/10 10:15, , 11F
06/10 10:15, 11F
推
06/10 10:26, , 12F
06/10 10:26, 12F
→
06/10 10:27, , 13F
06/10 10:27, 13F
→
06/10 10:31, , 14F
06/10 10:31, 14F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章