看板 C_and_CPP 關於我們 聯絡資訊
VS的話改成 #include "stdafx.h" #include<stdlib.h> 因為stdafx.h裡面就有include stdio.h了 ※ 引述《PanYX (Panpeter)》之銘言: : 開發平台(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), 來自: 114.34.141.204 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1463278671.A.538.html
LPH66: ......為什麼不要叫他直接 #include <stdio.h> ? 05/15 11:18
LPH66: stdafx.h 這種東西不要教給新手 05/15 11:19
kwpn: 答非所問... 05/15 12:17
james1022jk: 同一樓... 05/15 17:20