第一个程序

#include <iostream>
using namespace std;

int main() {
    cout<<"hello world"<<endl; //输出hello world
    cout<<1+2*3<<endl; //输出7
    return 0;
}

/*
 输出:
 hello world
 7
 */

/*
 一、程序的基本结构:共5行代码
 1. #include <iostream> 引入标准输入输出头文件,#include预编译命令,表示包含,iostream标准的输入输出文件,i input,o output,stream 流, cout<<会使用到,不引入cout会报错,找不到定义;
 2. using namesapce std; 打开标准命名空间,如果不写,后面的cout<< 要写成 std::cout<<;
 3. int main() main()是主函数,入口函数,只有一个,int是main函数的返回值类型,表示返回整数类型;
 4. 一对大括号{}表示函数体;
 5. return 0; main函数的返回值,必须写(main函数有返回值类型int)。
 
 二、程序写入的位置:写在{与return之间
 1. 语句以;号结束,一个;号代码一条语句;
 2. cout<<"hello world"<<endl; 输出hello world,再接着输出一个endl(换行),引号""里的字符原样输出;
 3. cout<<1+2*3<<endl; 输出数值7,算术运算;
 */