25 March, 2012

C++ Program For Cascading Of Operators.

This Post Contains A C++ Program For Cascading Of Operators With Correct Source Code & Output. This Program Is Written, Compiled & Executed At TurboC/C++3.0 Compiler & Will Help You To Understand The Concept Of 'Cascading' From C++ Language. It Is A Well-Structured Program With Proper Comments Which Provides Step-By-Step Description Of Various Features Of The Language In A Simple & Easy-To-Understand Way.
 
 
# Note : You Can Simply Copy-Paste The Following Program Into The Compiler For Direct Result. 


C++ Program For Cascading Of Operators.

/* Declaration Of Header Files */
#  include  <iostream.h>
#  include  <conio.h>

/* Start Of Main Program */
void main()
{
       
        /* Declaration Of Variables */
        int  a  =  0,  b  =  0;
        clrscr();

        /* Asking For The Input From User */
        cout  <<  "  Enter Values Of A & B  :  ";
        cin  >>  a  >>  b;

        /* Source Code For Cascading Of Operators */
        cout  <<  "  \n The Sum Of  "  <<  a  <<  " & "  <<  b  <<  " : "  <<  a  +  b;
        cout  <<  "  \n The Net Of  "  <<  a  <<  " & "  <<  b  <<  " : "  <<  a  -  b;
        cout  <<  "  \n The Product Of  "  <<  a  <<  " & "  <<  b  <<  " : "  <<  a  *  b;
        if  (  a  >  b  )
        {
               cout  <<  "  \n The Quotient Of  "  <<  a  <<  " Divided By "  <<  b  <<  " : "  <<  a  /  b;
        }
        else
        {
               cout  <<  "  \n The Quotient Of  "  <<  b  <<  " Divided By " <<  a  <<  " : "  <<  b  /  a;
        }
        getch();
}
/* End Of Main Program */ 

Output  :

Enter Values Of A & B  :  2  2

The Sum Of 2 & 2  :  4

The Net Of  2 & 2  :  0

The Product Of 2 & 2  :  4

The Quotient Of 2 Divided By 2  :  1




No comments:

Post a Comment

Subscribe To:

Most Commonly Asked Programs In 'C' & 'C++' Language.