注意事项:if 后不要加分
#include <stdio.h>
#include <iostream>
using namespace std;
/*------------------------------------------------------------------------------
程序流程结构
1.顺序结构:程序按顺序执行,不发生跳转
2.选择结构:依据条件是否满足,有选择的执行相应功能
if语句:
单行
多行
多条件-if,else if ...else
3.循环结构:依据条件是否满足,循环多次执行某段代码
------------------------------------------------------------------------------*/
//2.选择结构 和 嵌套if语句
int main()
{
//1. 用户输入分数
int score = 0;
cout <<"请输入一个分数"<< endl;
cin >> score;
//2.打印用户输入的分数
cout <<"分数为"<<score<< endl;
// 3.判断分数是否大于某值
//注意事项:if 后不要加分
if (score > 600)
{
cout << "恭喜考上一本" << endl;
//嵌套if语句
if (score > 700)
{
cout << "恭喜考上大学1" << endl;
}
else if (score > 650)
{
cout << "恭喜考上大学2" << endl;
}