1.1 Hello world
C++是一门面向对象的编程语言。
#include <iostream> //输入输出流 in输入 out输出
using namespace std;//使用命名空间 std 即打开一个std的房间
//防止命名冲突,比如cout就是用的std房间中的,不是其他地方的
//函数入口地址
int main()
{
//cout 标准的输出
//左移运算符,拼接字符串
//endl结束换行,去掉即不换号
cout << "Helloworld" << endl;
//若取消上方using namespace std;(一般不取消)
//则代码应该为std: cout << "Helloworld" << endl;
system("pause");//阻塞功能
return EXIT_SUCCESS;//EXIT_SUCCESS=0,即成功的离开、返回正常
}
附加:
1、不在后面加.h了
.h一般是C语言,比如math.h ->cmath,一看就是C++代码
面向对象三大特性
1、封装:抽象成类
2、继承
3、多态:一个接口多种方法