注册 登录
编程论坛 VC++/MFC

[vc++]【笔记】学习c++的第2天

e小陌 发布于 2021-02-25 01:06, 1405 次点击
程序代码:

#include<iostream>                                      //包含头文件输入输出流
using namespace std;                                    //使用命名空间std
int main()                                              //整型主函数
{
    int a;                                              //声明整型变量a
    int b;                                              //声明整型变量b
    cout<<"hello,这是学习c++的第2天。\n";               //输出字符串
    cout<<"请输入a的值:";                              //输出字符串
    cin>>a;                                             //输入变量a的值,给变量a赋值
    cout<<endl;                                         //输出换行符
    cout<<"a的值是:"<<a<<endl;                         //输出字符串加a的值加换行符
    cout<<"请输入a的值:";                              //输出字符串
    cin>>b;                                             //输入变量b的值,给变量b赋值
    cout<<endl;                                         //输出换行符
    cout<<"b的值是:"<<b<<endl;                         //输出字符串加b的值加换行符
    return 0;                                           //返回0
}



【课程概况】
   这是声明变量以及对变量赋值的输入输出操作

[此贴子已经被作者于2021-3-1 15:10编辑过]

0 回复
1