Thursday, July 30, 2009

How to make a program in C++(turbo c++) that can do addition with the given of two integers?

how to make a program in C++(turbo c++) that can do addition with the given of two integers?





I know this is odd but i just want to know how?what if I want to compute 3 integers or 4? How do I do it?





by the way I'm a beginner. Plese don't tell me to find it in the internet because I've already did it. the syntax is different because were using a very old turbo c++ compiler (v1.01)





post the program here...thanks

How to make a program in C++(turbo c++) that can do addition with the given of two integers?
#include%26lt;iostream%26gt;


using namespace std;





int main(int argc, char **argv)


{


int a,b,c,i;


int g=2;


c=0;


for (i = 0; i%26lt;g; i++)


{


cout %26lt;%26lt; "get number";


cin %26gt;%26gt; a;


c = c+a;


}


cout %26lt;%26lt; "number is " %26lt;%26lt; c;


}





just change the number 2 with the number of integets you want to add


No comments:

Post a Comment