分支-01. 超速判断

来源:互联网 发布:web前端页面性能优化 编辑:程序博客网 时间:2024/06/10 04:52

分支-01. 超速判断

模拟交通警察的雷达测速仪。输入汽车速度,如果速度超出60 mph,则显示“Speeding”,否则显示“OK”。

输入格式:

输入在一行中给出1个不超过500的非负整数,即雷达测到的车速。

输出格式:

在一行中输出测速仪显示结果,格式为:“Speed: V - S”,其中V是车速,S或者是Speeding、或者是OK。

输入样例1:
40
输出样例1:
Speed: 40 - OK
输入样例2:
75
输出样例2:
Speed: 75 - Speeding

#include <iostream>using namespace std;int main(){    int speed;    cin >> speed;    if(speed > 60){    cout << "Speed: " << speed << " - Speeding" << endl;    } //};是错的     else{    cout << "Speed: " << speed << " - OK" << endl;              }     return 0;} 
0 0
原创粉丝点击