023.程序流程结构-选择结构-单行if

#include <iostream>
using namespace std;
int main()
{
    //选择结构 单行if语句
    //用户输入分数,如果分数大于600,视为考上一本大学,在屏幕上输出

    //1.用户输入分数
    int scroe = 0;
    cout << "请输入一个分数:" << endl;
    cin >> scroe;

    //2.打印用户输入的分数;
    cout << "你输入的分数是:" << scroe << endl;

    //3.判断分数是否大于600,如果大于600,输出
    //注意事项,if条件后面不要加分号;

    if (scroe > 600)//大于600执行
    {
        cout << "你考上的一本大学" << endl;

    }

    system("pause");
    return 0;
}

 

posted @ 2021-09-03 19:44  梦之心  阅读(49)  评论(0编辑  收藏  举报