c++ primer学习指导(4)--1.3注释简介

注释分两种

1、单行注释,注释的内容从//开始,一直到换行符结束

2、多行注释(界定符对注释),其内容由 /* 和 */ 进行界定

注释界定符不能嵌套

例子:

 1 #include <iostream>
 2 /*
 3 界定符对注释
 4 */
 5 
 6 /*
 7 /*这三行注释是非法的,界定符对注释不能嵌套*/
 8 */
 9 int main()
10 {
11     // prompt user to enter two numbers
12     std::cout << "Enter two numbers:" << std::endl; 
13     int v1 = 0, v2 = 0;  //单行注释
14     std::cin >> v1 >> v2;   
15     std::cout << "The sum of " << v1 << " and " << v2
16               << " is " << v1 + v2 << std::endl;
17     return 0;
18 }
原文地址:https://www.cnblogs.com/niao-ge/p/12146191.html