Any help would be great thanks. I need to write a program simulating a state pol
ID: 3629181 • Letter: A
Question
Any help would be great thanks.
I need to write a program simulating a state police radar detector speed. The program should read an automobile speed and print the message "speeding" if the speed exceeds 55 mph.
In this program the if else statement are used. This is what I have so far. I dont know if its correct.
#include <iostream>
using namespace std;
int main()
{
int speed;
if (speed > 55)
radar = speeding;
else if (speed < 55)
radar = not speeding;
cout << "The car is speeding when the speed is > 55" It is not speeding when the speed is speed < 55
return 0;
}
Explanation / Answer
please rate - thanks
#include <iostream>
using namespace std;
int main()
{
int speed;
cout<<"Enter car speed: ";
cin>>speed;
if (speed > 55)
cout<<"Speeding ";
else
cout<<"Not speeding ";
system("pause");
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.