C++ entry plan (1)

#include<iostream>//预编译(处理),调用iostream文件中的内容
#define Hello_World "hello world"//宏定义
using namespace std;//命名空间,c++的标准程序库中的所有标识符都被定义在一个std的命名空间中
int main()
{
    
    
	cout << Hello_World << endl;//会自动换行 第二个输出不会换行(对比)
	std::cout << "hello world ";//若不使用命名空间 则需要在标识符前加std::
	cout << Hello_World << endl;//endl 即相当于在控制台窗口按下enter  即 printf 与 print的区别(换行)
	//  <<  表示向前发送数据   eg:该输出中 << 就向 cout 发送输出的字符串字符
	return 0;
}


/*
我们可以将命名空间想象成区号,将类名想象为一个电话号码。
由于各省市的电话号码可能重复,就通过在电话号码前面加上区号使得该号码成为一个独一无二的表示。
Java中也有类似的机制,包名就如同区号,类名就如同电话号码。 
*/

Run the screenshot
as shown in the figure, when endl is added, it will automatically wrap, if not add endl, it will stop at the original line.
Insert picture description here

Guess you like

Origin blog.csdn.net/hx_521/article/details/108606641