关闭

1274 不好玩的罚金

124人阅读 评论(0) 收藏 举报
分类:

注意输出的格式(空格)。

#include<iostream>
using namespace std;

int main()
{
	int limit;
	cout << "Enter the speed limit:" << ' ';
	cin >> limit;
	int speed;
	cout << "Enter the recorded speed of the car:" << ' ';
	cin >> speed;
	if (speed <= limit)
	{
		cout << "Congratulations, you are within the speed limit"
			<< endl;
	}
	if (1 <= speed - limit&&speed - limit <= 20)
	{
		cout << "You are speeding and your fine is $ 100"
			<< endl;
	}
	if (21 <= speed - limit&&speed - limit <= 30)
	{
		cout << "You are speeding and your fine is $ 270"
			<< endl;
	}
	if (31 <= speed - limit)
	{
		cout << "You are speeding and your fine is $ 500"
			<< endl;
	}
	return 0;
}

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:38664次
    • 积分:2860
    • 等级:
    • 排名:第12509名
    • 原创:259篇
    • 转载:21篇
    • 译文:0篇
    • 评论:2条
    最新评论