先写代码:
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
cout<<"hello world! "<<endl;
system("pause");
return 0;
}
解释一下,
#include <iostream>(c++)
是标准库头文件
#include <cstdio>
是标准库头文件(c)
using namespace std;
命名空间
int main()
{
}
是主函数
cout<<"hello world! "<<endl;
是计算机打印:“helloworld”
system("pause");
是让用户按任意键继续
return 0;
是返回0,在主函数里代表程序结束。