speed limit c++ code example

Example: speed limit c++

int main()
{

   double speed = 0;
  // double limit = 65;
   double fine = 10;

  
cout << "Input speed of vehicle: ";
cin >> speed;


//fine = ((speed - limit) * 10);
//cin >> fine >> endl;

if (speed > 65)
{cout << "You should slow down " << endl;
fine = ((speed - limit) * 10);

//cout << "Your fine is ";
//cin >> fine >> endl;
}  
else if (speed >= 40)
{cout << "You are doing a great job " << endl;
//fine = 0
}
else if (speed <= 39)
{cout << "You need to speed up " << endl;
//fine = 0


}

     
    system("pause"); //holds the command window open
    return 0; //ends the program
}

Tags:

Cpp Example