Friday, July 31, 2009

Whats wrong with this C++ program??????

#include %26lt;iostream%26gt;


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





int();


{


std::cout %26lt;%26lt; "add two numbers....The first one will be subtracted from the second" %26lt;%26lt; std::endl;


int v1, v2;


std::cout %26lt;%26lt; "The no: to be sbtracted" %26lt;%26lt; std::endl;


std::cin %26gt;%26gt; v1;


std::cout %26lt;%26lt;"The no: to subtract from" %26lt;%26lt; std::endl;


std::cin %26gt;%26gt; v2;


std::cout %26lt;%26lt;"The difference between " %26lt;%26lt; v1 %26lt;%26lt;"and" %26lt;%26lt; v2 %26lt;%26lt; "is" %26lt;%26lt; v2-v1 %26lt;%26lt; std::endl;





return 0;


}





--------------------------------------...





Please re do the program if you find the error.


Its a subtraction

Whats wrong with this C++ program??????
I think the first line has to be 'int main()'





ie add 'main' and lose the terminating ';'. The bit between the braces is defining 'main', so we don't want to terminate before we reach it!
Reply:hahaha simple mistake Report It



No comments:

Post a Comment