作者ilway25 (Chaos)
看板EE_DSnP
標題[情報] 如何學寫 C 程式
時間Wed Oct 24 20:11:54 2007
http://tinyurl.com/2ftt6o
這是我在 C_and_CPP 版看到的
覺得蠻適合初學者觀念建立的
不過語言是 C
沒有 cin 和 cout
所以可能這部份可能要自己再去找資料看看囉
--
大致來說(個人觀察結果,不一定對...)
cout 對應 printf
cin 對應 scanf
不過語法不一樣... 而且是 #include <stdio.h>
ex:
printf("number is %d and %d, char is %c\n", 123, 456, 'a');
就是
cin << "number is " << 123 << "and" << 456 << ", char is" << 'a' << endl;
其中兩個 %d 依序代表後面的整數,%c 是字元,%s 字串,%u unsigned 等
int i;
scanf("%d", &i);
scanf 的變數要加 &
--
想增加無聊程度可以看這個
http://tinyurl.com/24tjw8
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.249.57