Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 22nd, 2010 | Syntax: None | Size: 0.73 KB | Hits: 82 | Expires: Never
Copy text to clipboard
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main ()
  5. {
  6.     //declaration
  7.    
  8.     double num1, num2, num3, LargestNum;
  9.    
  10.     //number input
  11.    
  12.     cout << "Enter a number: ";
  13.     cin >> num1;
  14.    
  15.     cout << "Enter another number: ";
  16.     cin >> num2;
  17.    
  18.     cout << "Enter yet another number: ";
  19.     cin >> num3;
  20.    
  21.     //finding the largest number
  22.  
  23.          LargestNum = num1;
  24.        
  25.         if (num2>LargestNum)
  26.         {
  27.          LargestNum = num2;
  28.         }
  29.        
  30.         if (num3>LargestNum)
  31.         {
  32.          LargestNum = num3;
  33.         }
  34.    
  35.     //displaying the largest number
  36.    
  37.     cout << "\nThe largest number is: " << LargestNum << endl;
  38.    
  39.     system("pause");
  40.     return 0;
  41.    
  42. }