Friday, May 21, 2010

I want to the simple concept of c++ and some simple programm code.?

its means that i want to the code of addition and subtriction. that is how we start this program,i.e addition.


plz in simple form, i have a c++ software,a and practice on it but not good,

I want to the simple concept of c++ and some simple programm code.?
hi,


program starts with header file,follwed by main() function and some declarations,defini,statements,functions wat ever u want u put..


#include%26lt;iostream.h%26gt;


#include%26lt;conio.h%26gt;


#include%26lt;stdlib.h%26gt;


void main()


{


int a,b,c,d;


cout%26lt;%26lt;"enter 2 numbers\n";


cin%26gt;%26gt;a%26gt;%26gt;b;


c=a+b;


d=a-b;


cout%26lt;%26lt;"After addition " %26lt;%26lt;c%26lt;%26lt;endl;


cout%26lt;%26lt;"After subtracton" %26lt;%26lt;d%26lt;%26lt;endl;


getch();


}
Reply:#include %26lt;iostream.h%26gt;


#include %26lt;conio.h%26gt;





void main()


{


int a, b, sum, difference;


sum = 0;


difference = 0;


cout%26lt;%26lt;"Enter the first number: "%26lt;%26lt;flush;


cin%26gt;%26gt;a;





cout%26lt;%26lt;"\nEnter the second number: "%26lt;%26lt;flush;


cin%26gt;%26gt;b;





sum = a + b;


cout%26lt;%26lt;"\nThe sum of numbers = "%26lt;%26lt;a + b%26lt;%26lt;flush;





cout%26lt;%26lt;"\nSecond number subtracted from first = "%26lt;%26lt;difference%26lt;%26lt;flush;





getch();


}


No comments:

Post a Comment