Programming Principle Day 1 Hello World!
//This program outputs the message"Hello World!" to your screen:
# include "std_lib_facilities.h"
int main() //C++ programs start by executing the function main
{
cout << "Hello World!\n"; //output "Hello World!"
return 0;
}
知识点汇总
# include “std_lib_facilities.h” // “# include”指令行要求从"std_lib_facilities.h"标准库中引用(C++stream, I/O 功能)功能
cout // 标准输出流
<< // 输出操作符
“std_lib_facilities.h” // 使用#include 操作符引入的文件通常具有后缀".h",被称为头文件,内含各类术语定义
main 开始执行程序标志
函数组成部分
int main() //C++ programs start by executing the function main
{
cout << "Hello World!\n"; //output "Hello World!"
return 0;
}
返回类型(int)
函数名(main)
变量列表(位于"函数名()"圆括号内)
函数主体(使用中括号封闭)
另附
没有使用"#include” 操作符或使用了其他操作符的程序被称为陈述(the smallest executable entity within a programming language)