Compare int value with constant value - C++ Data Type

C++ examples for Data Type:const

Description

Compare int value with constant value

Demo Code

#include <iostream>
using namespace std;
int main()//from  ww  w  . j  av a  2 s  .c  om
{
   const double LIMIT = 3000.0;
   int id;
   double miles;
   cout << "Please type in car number and mileage: ";
   cin  >> id >> miles;
   if (miles > LIMIT)
      cout << " Car " << id << " is over the limit.\n";
   cout << "End of program output.\n";
   return 0;
}

Result


Related Tutorials