BCS-1A

Saturday, December 31, 2011

Greater or Less then in Giver three Numbers


/*****************************************************
  Name: Three number calculator
 
  Copyright: BCS-1A
 
  Author:Muhammad Hussnain Imtiaz
 
  Date: 20/12/11 22:07
 
  Description: To calculate three numbers
*******************************************************/

  // preprocesser directive
 # include <iostream>
 # include <conio.h>

 using namespace std ;

 int main ()
{
// local declaration
float num1 = 0.0 ,
      num2 = 0.0 ,
      num3 = 0.0 ,
      sum  = 0.0 ,
      ;



    cout <<        "                  Welcome             " << endl << endl ;


    cout <<        "      Please Enter First  Number  :   " ;
    cin  >> num1 ;
    cout << endl <<"      Please Enter Second Number  :   " ;
    cin  >> num2 ;
    cout << endl <<"      Please Enter Third  Number  :   " ;
    cin  >> num3 ;
    cout << endl ;
       

    sum = num1 + num2 + num3 ;
   
    cout <<          "           The     sum   is :   " << sum << endl << endl ;
   
   
   
    if ( num1 == num2 && num2 == num3 )
    {
       cout <<       "              All no. are equal         " ;    
    }
   
   
    if ( num1 != num2 && num2 != num3 )
    {
       cout << "          Input numbers are not equle   " << endl ;
    }
   
   
    if ( num1 > num2 && num1 > num3 )
    {
       cout << "               " << num1 << " > " << num2 << " and " << num3 << "\n" ;
    }
   
   
    if ( num2 > num3 && num3 > num1 )
    {
       cout << "               " << num2 << " > " << num1 << " and " << num3 << "\n" ;
    }
   
   
    if ( num3 > num1 && num1 > num2 )
    {
       cout << "               " << num3 << " > " << num1 << " and " << num2 << "\n" ;
    }
   

    if ( num1 < num2 && num1 < num3 )
    {
       cout << "               " << num1 << " < " << num2 << " and " << num3 << "\n" ;
    }

   
    if ( num2 < num3 && num3 < num1 )
    {
       cout << "               " << num2 << " < " << num1 << " and " << num3 << "\n" ;
    }
   

    if ( num3 < num1 && num1 < num2 )
    {
       cout << "               " << num3 << " < " << num1 << " and " << num2 << "\n" ;
    }
   
   
    if ( num1 == num2 && num1 > num3 )
    {
       cout << "First number = Second number but " << num3 << " < First and Second number \n" ;
    }
   

    if ( num2 == num3 && num2 > num1 )
    {
       cout << "Second number = Third number but " << num1 << " < Second and Third number \n" ;
    }
   

    if ( num3 == num1 && num3 > num2 )
    {
       cout <<  "First number = Third number but " << num2 << " < First and Third number \n" ;
    }
   
 
    if ( num1 == num2 && num1 < num3 )
    {
       cout << "First number = Second number but " << num3 << " > First and Second number \n" ;
    }
   

    if ( num2 == num3 && num2 < num1 )
    {
       cout << "Second number = Third number but " << num1 << " > Second and Third number \n" ;
    }
   

    else if ( num3 == num1 && num3 < num2 )
    {
       cout << "First number = Third number but " << num2 << " > First and Third number \n" ;
    }
   

    else
    {
       cout << endl << "        " ;
    }
   
       cout << endl << "                   T h a n k s               " ;
     
    cout << "\n\n\n\n\n\n      Created By : Mohammad Hussnain Imtiaz " ;

 
  getch () ;
  return 0 ;
} // end of main function

No comments:

Post a Comment