C++ Function Definition Doubles the user's number

Description

C++ Function Definition Doubles the user's number

#include <iostream>
using namespace std;
int doub (int num);
int main()/*from w w w  .ja va  2  s. com*/
{
   int number;      
   int d_number;    
   cout << "What number do you want doubled? ";
   cin >> number;
   d_number = doub(number);   
   cout << number << " doubled is " << d_number;
   return 0;
}
int doub(int num)
{
   int d_num;
   d_num = num * 2;           
   return (d_num);            
}



PreviousNext

Related