新標準C++程序設計 郭煒 編著ios
#include <iostream> #include <cstdio> using namespace std; int main() { printf("Hello, world!"); return 0; } //Result: Hello, world!
#include <cstdio> #include <iostream> using namespace std; int main() { int a = 3; printf("I have %d dollars.\n", a); printf("I want to buy:\na book."); return 0; } /* result is as follows: I have 3 dollars. I want to by: a book. */
輸入兩個整數,輸出它們的和(NOI. POJ 7883)spa
#include <cstdio> #include <iostream> using namespace std; int main() { int a, b; scanf("%d%d", &a, &b); printf("%d", a+b); return 0; } /** Input & Output is as follows: 3 4 <Enter> 7 **/
#include <cstdio> #incluce <iostream> int main() { char a, b, c; scanf("%c%c%c", &a, &b, &c); printf("%c%c%c", a, b, c); return 0; } /* I & O: x y x y */