Below is your code:
#include <iostream>
using namespace std;
int main() {
//get speed from user
int speed;
cout<<"Enter your speed in kmph: ";
cin>>speed;
//conditional operator to check if speeding ticket is there or not
bool speedingTiket = speed > 90? true: false;
//printing the result
if(speedingTiket) {
cout<<"You got a speeding ticket. Please drive slow next time."<<endl;
} else {
cout<<"No Speeding ticket for you."<<endl;
}
}
Output
Get Answers For Free
Most questions answered within 1 hours.