c++ primer学习指导(3)--1.2初识输入输出

源码在add.cpp,内容如下

 

 1 int main()
 2 {
 3     // prompt user to enter two numbers
 4     std::cout << "Enter two numbers:" << std::endl; 
 5     int v1 = 0, v2 = 0;
 6     std::cin >> v1 >> v2;   
 7     std::cout << "The sum of " << v1 << " and " << v2
 8               << " is " << v1 + v2 << std::endl;
 9     return 0;
10 }

 

编译运行:

posted @ 2020-01-03 16:43  鸟哥01  阅读(120)  评论(0编辑  收藏  举报