Read double type value from commandline using cin - C++ Data Type

C++ examples for Data Type:double

Description

Read double type value from commandline using cin

Demo Code

#include <iostream>
using namespace std;
int main()//from w w  w. j  a  v a 2s .c  om
{
   double num1, num2, product;
   cout << "Please type in a number: ";
   cin  >> num1;
   cout << "Please type in another number: ";
   cin  >> num2;
   product = num1 * num2;
   cout << num1 << " times " << num2 << " is " << product << endl;
   return 0;
}

Result


Related Tutorials