Thursday, July 9, 2009

C++ help!!!!!!!!!!!!!!!!!!!!!!!!?

I need help 2 make a program 2 show the largest of the numbers entered

C++ help!!!!!!!!!!!!!!!!!!!!!!!!?
#include %26lt;iostream%26gt;


using namespace std;





int main()


{


int nFirst = 13;


int nSec = 7;


if(nFirst %26lt; nSec)


{


cout %26gt;%26gt; "nFirst is greater";


}


else{


cout %26gt;%26gt; "nSec is greater";


}





// return zero to exit application


return(0);


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


void main()


{


int a,b;


cin %26gt;%26gt; a;


cin %26gt;%26gt; b;


if (a %26gt; b)


cout %26lt;%26lt; a %26lt;%26lt; "\n";


else


cout %26lt;%26lt; b %26lt;%26lt; "\n";


}
Reply:Ask the user to enter the two numbers using the "cin" command.





Compare the two numbers using the "if()" statement.


No comments:

Post a Comment