#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
printf("Hello World!");
return 0;
}
变量
#include <iostream>
using namespace std;
int main()
{
int a = 3;
printf("I want to buy %d book.\n", a);
printf("I want to buy :\n");
printf("a book");
return 0;
}
sum two number
#include <iostream>
using namespace std;
int main()
{
int a, b;
scanf("%d %d", &a, &b);
printf("%d", a + b);
return 0;
}
读写字符
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
char a, b, c;
scanf("%c%c%c", &a, &b, &c);
printf("%c%c%c", a, b, c);
return 0;
}
sizeof( )求变量占用字节数
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int n = 10;
double f;
char c;
printf("%d %d %d %d", sizeof(short), sizeof(n),
sizeof(f), sizeof(c));
return 0;
}