看板 C_and_CPP 關於我們 聯絡資訊
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) VC++ 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): 本人是程式新手 很新很新那種 目前在看板上推薦入門的洪維恩 C語言教學手冊 第4版 按照例題 把程式碼打進去 執行結果 在看書上的解釋 作者是使用dev C++來寫 但我是用Visual studio community 2015來寫 有時候執行的程式結果會不同 想問在學習過程會有差嗎? 還有 我目前學習方法正確嗎? 感覺有點打完程式碼 執行程式就算了的感覺... 餵入的資料(Input): 預期的正確結果(Expected Output): dev c++ ch=2 the ASCII of ch is 50 錯誤結果(Wrong Output): vs ch=a the ASCII of ch is 97 程式碼(Code):(請善用置底文網頁, 記得排版) #include<stdio.h> #include<stdlib.h> int main(void) { char ch = 'a'; printf("ch=%c \n", ch); printf("the ASCII of ch is %d \n", ch); system("pause"); return 0; } 補充說明(Supplement): -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 180.205.136.177 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1463200096.A.99F.html
Caesar08: 有vs可以用,那就不要用dev c++了 05/14 13:22
PanYX: 那結果有差異 也沒關係嗎? 05/14 14:09
Caesar08: 你要不要放一下code,我們才知道差異是甚麼 05/14 14:20
※ 編輯: PanYX (180.205.136.177), 05/14/2016 15:10:10
PanYX: 還有scanf()函數 在vs裡要用scanf_()函數不然無法執行 查go 05/14 15:15
longlongint: ch='2' 05/14 15:16
PanYX: ole才知道 05/14 15:16
Caesar08: 你確定你code沒打錯? 05/14 15:19
PanYX: ...我好像自己搞烏龍= = 我在試試 謝謝各位解答 05/14 15:24