作者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