文章内容发布于 483 天前;最后修改于 483 日前。其中的信息可能发生变化或产生更改,敬请留意。
多行 if 语句:相当于是多加了几个单词。
语法if (条件){执行的内容}else{不满足条件执行的内容}
。
eg:
#include <iostream>
using namespace std;
int main()
{
//选择结构 多行if语句;
//输入一个分数,如果大于600,则考上一本,然后进行输出,如果没有考上,则提示没考上。
int scores = 0;
cout << "请输出您的分数" << endl;
cin >> scores;
cout << "您的分数:" << scores << endl;
if (scores > 600)
{
cout << "考上一本" << endl;
}
else
{
cout << "把握进厂时间" << endl;
}
system("pruse");
return 0;
}
:-)