Read int and do the calculation : int read « Data Types « C++ Tutorial






#include <iostream>

using namespace std;

int main()
{  
   cout << "How many pennies do you have? ";
   int count;
   cin >> count;
   double total = count * 0.01;

   cout << "How many nickels do you have? ";
   cin >> count;
   total = count * 0.05 + total;

   cout << "How many dimes do you have? ";
   cin >> count;
   total = count * 0.10 + total;

   cout << "How many quarters do you have? ";
   cin >> count;
   total = count * 0.25 + total;
   
   cout << "Total value = " << total << "\n";

   return 0;
}








2.2.int read
2.2.1.Read int and do the calculation
2.2.2.Use relational operators to compare int type variables
2.2.3.Read integer from console using cin
2.2.4.Read int and char array from keyboard