C++ Primer day 01
1.标准输入与输出
#include<iostream> int main(){ int v1,v2; std::cout<<"Enter two numbers:"<<std::endl; std::cin>>v1>>v2; std::cout<<"The multiply of "<<v1<<" and "<<v2<<" is "<<v1*v2<<std::endl; }
2.注释
注释的作用:概述算法、确定变量的用途、解释晦涩难懂的代码段.
C++两种注释:单行注释和界定符对注释.
#include<iostream> int main(){ int v1,v2; //定义变量 std::cout<<"Enter two numbers:"<<std::endl; //提示用户输入两个变量数据 std::cin>>v1>>v2; std::cout<<"The multiply of "<<v1<<" and "<<v2<<" is "<<v1*v2<<std::endl; /* 多行注释 /* */嵌套注释 */ }