Sunday, July 26, 2009

C++ code help?

is their any blank syombyl in c++ because i want to have the if dnumber3 == after that i want it to say if it is blank go to this or whatever. is their a way to do it?


case '+':


if( dnumber3 ==_ ){


cout %26lt;%26lt; "your answer is:" %26lt;%26lt; dnumber1 %26lt;%26lt; " + " %26lt;%26lt; dnumber2 %26lt;%26lt; " = " %26lt;%26lt; (dnumber1 + dnumber2 ) %26lt;%26lt; endl;


}else{


case '+':


cout %26lt;%26lt; "your answer is:" %26lt;%26lt; dnumber1 %26lt;%26lt; " + " %26lt;%26lt; dnumber2 %26lt;%26lt; " + " %26lt;%26lt; dnumber3 %26lt;%26lt; "=" %26lt;%26lt;(dnumber1 + dnumber2 + dnumber3) %26lt;%26lt; endl;


break;


}

C++ code help?
just pur "" after ==





and after endl please put () if it still doesn't work.





enjoy programming
Reply:I had the same problem I had c+c+ run time library it was a virus
Reply:if(dnumber3=="" || dnumber3==null)
Reply:It depends on what kinda variable dnumber is? If it is an integer, you can do:


if(dnumber) {


// dnumber is not null, and not zero


}





If its a string you can do:


if(dnumber != NULL %26amp;%26amp; !dnumber.equals("")){


// dnumber is not null and not empty string


}
Reply:The empty string : ""


No comments:

Post a Comment