Click here to Skip to main content
15,904,348 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Solution Pin
cmk20-Nov-03 16:13
cmk20-Nov-03 16:13 
GeneralFor cmk Pin
Vancouver21-Nov-03 9:09
Vancouver21-Nov-03 9:09 
GeneralRe: For cmk - back to Vancouver Pin
cmk21-Nov-03 12:02
cmk21-Nov-03 12:02 
GeneralDirectshow and painting Pin
georgiek5020-Nov-03 6:31
georgiek5020-Nov-03 6:31 
Generalproblem with if statement Pin
si_6920-Nov-03 4:43
si_6920-Nov-03 4:43 
GeneralRe: problem with if statement Pin
LittleYellowBird20-Nov-03 5:02
LittleYellowBird20-Nov-03 5:02 
GeneralRe: problem with if statement Pin
si_6920-Nov-03 5:47
si_6920-Nov-03 5:47 
GeneralRe: problem with if statement Pin
Ian Darling20-Nov-03 6:01
Ian Darling20-Nov-03 6:01 
It might be better to treat it as a truth table - Alison is right.

treat a as your first string check, eg:
bool a = (str != "Whatever");

treat b as your second one:
bool b = (str != "Something else");

then you have (effectively):
if(a || b)<br />
{<br />
// do stuff<br />
}


So if str is "Whatever", then a == false, but b == true, so (a || b) == true as well, and so it goes into the if
If str is "Something else", then a == true, b == false, so (a || b) == true again, so it goes into the if
If str is any other string, then a == true, b == true, so (a || b) == true, and so it goes into the if.

What you probably want is:
if( (str != "Whatever) && (str != "Something else") )<br />
{<br />
// do stuff.<br />
}


--
Ian Darling
"The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
GeneralRe: problem with if statement Pin
Big Art20-Nov-03 5:56
Big Art20-Nov-03 5:56 
GeneralRe: problem with if statement Pin
TFrancis20-Nov-03 6:07
TFrancis20-Nov-03 6:07 
GeneralRe: problem with if statement Pin
Michael Dunn20-Nov-03 9:55
sitebuilderMichael Dunn20-Nov-03 9:55 
GeneralRe: problem with if statement Pin
Stye21-Nov-03 17:01
Stye21-Nov-03 17:01 
GeneralBrowse CD option Pin
Anonymous20-Nov-03 3:50
Anonymous20-Nov-03 3:50 
GeneralRe: Browse CD option Pin
Peter Molnar20-Nov-03 13:52
Peter Molnar20-Nov-03 13:52 
GeneralAfxSetResourceHandle() - I failed to load the default resources of the application. Pin
julych20-Nov-03 3:45
julych20-Nov-03 3:45 
GeneralRe: AfxSetResourceHandle() - I failed to load the default resources of the application. Pin
Antti Keskinen20-Nov-03 9:50
Antti Keskinen20-Nov-03 9:50 
GeneralRe: AfxSetResourceHandle() - I failed to load the default resources of the application. Pin
julych20-Nov-03 10:27
julych20-Nov-03 10:27 
GeneralCMenu question Pin
Niko Tanghe20-Nov-03 2:10
Niko Tanghe20-Nov-03 2:10 
GeneralRe: CMenu question Pin
KingsGambit20-Nov-03 2:51
KingsGambit20-Nov-03 2:51 
GeneralRe: CMenu question Pin
Niko Tanghe20-Nov-03 3:19
Niko Tanghe20-Nov-03 3:19 
GeneralRe: CMenu question Pin
Roger Allen20-Nov-03 5:39
Roger Allen20-Nov-03 5:39 
GeneralData type HANDLE Pin
Anonymous20-Nov-03 1:57
Anonymous20-Nov-03 1:57 
GeneralRe: Data type HANDLE Pin
Simon.W20-Nov-03 2:05
Simon.W20-Nov-03 2:05 
GeneralRe: Data type HANDLE Pin
Toco20-Nov-03 3:06
Toco20-Nov-03 3:06 
GeneralRe: Data type HANDLE Pin
Anonymous20-Nov-03 4:06
Anonymous20-Nov-03 4:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.