Click here to Skip to main content
15,885,216 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: To bool or not to bool in C/C++ ? Pin
leon de boer23-Feb-20 5:29
leon de boer23-Feb-20 5:29 
GeneralRe: To bool or not to bool in C/C++ ? Pin
Richard MacCutchan23-Feb-20 6:08
mveRichard MacCutchan23-Feb-20 6:08 
GeneralRe: To bool or not to bool in C/C++ ? Pin
Victor Nijegorodov23-Feb-20 20:43
Victor Nijegorodov23-Feb-20 20:43 
GeneralText based mining game using if and while Pin
Chleba22519-Feb-20 10:41
Chleba22519-Feb-20 10:41 
GeneralRe: Text based mining game using if and while Pin
Stefan_Lang19-Feb-20 21:42
Stefan_Lang19-Feb-20 21:42 
GeneralRe: Text based mining game using if and while Pin
Vaclav_20-Feb-20 17:04
Vaclav_20-Feb-20 17:04 
GeneralRe: Text based mining game using if and while Pin
Chleba22521-Feb-20 20:32
Chleba22521-Feb-20 20:32 
SuggestionRe: Text based mining game using if and while Pin
David Crow24-Feb-20 3:44
David Crow24-Feb-20 3:44 
Chleba225 wrote:
else if(startWay != 1 || 2){
cout << "\nError, try again.\n\n";
}
} //while loop
}else if(marketWay != 1 || 2){
I'm sure your intent was something closer to:
else if (startWay != 1 && startWay != 2)
...
else if (marketWay != 1 && marketWay != 2)
...
Otherwise the OR part of the condition would evaluate to true and display the message.

Going one step further, since each of these if/else if pairs are only interested in the values 1 or 2, there's no need to check against those values at the end to determine if the message needs displaying. Just use an else by itself.

"One man's wage rise is another man's price increase." - Harold Wilson

"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles



modified 24-Feb-20 12:52pm.

QuestionCannot open file 'hid.lib' in microsip Pin
Jafar_Ulla19-Feb-20 2:14
professionalJafar_Ulla19-Feb-20 2:14 
AnswerRe: Cannot open file 'hid.lib' in microsip Pin
CPallini19-Feb-20 2:51
mveCPallini19-Feb-20 2:51 
QuestionUse of string class in c++ Pin
Awantika Singh14-Feb-20 21:26
Awantika Singh14-Feb-20 21:26 
AnswerRe: Use of string class in c++ Pin
Victor Nijegorodov14-Feb-20 21:35
Victor Nijegorodov14-Feb-20 21:35 
AnswerRe: Use of string class in c++ Pin
Stephane Capo14-Feb-20 21:38
professionalStephane Capo14-Feb-20 21:38 
GeneralRe: Use of string class in c++ Pin
Awantika Singh15-Feb-20 4:27
Awantika Singh15-Feb-20 4:27 
GeneralRe: Use of string class in c++ Pin
Richard MacCutchan15-Feb-20 5:06
mveRichard MacCutchan15-Feb-20 5:06 
GeneralRe: Use of string class in c++ Pin
Stephane Capo15-Feb-20 21:52
professionalStephane Capo15-Feb-20 21:52 
GeneralRe: Use of string class in c++ Pin
k505416-Feb-20 3:30
mvek505416-Feb-20 3:30 
GeneralRe: Use of string class in c++ Pin
Richard MacCutchan16-Feb-20 4:58
mveRichard MacCutchan16-Feb-20 4:58 
GeneralRe: Use of string class in c++ Pin
CPallini16-Feb-20 7:28
mveCPallini16-Feb-20 7:28 
GeneralRe: Use of string class in c++ Pin
Stefan_Lang16-Feb-20 22:43
Stefan_Lang16-Feb-20 22:43 
GeneralRe: Use of string class in c++ Pin
CPallini16-Feb-20 23:02
mveCPallini16-Feb-20 23:02 
QuestionVfW Saving Compression Options Pin
Member 1305023114-Feb-20 5:35
Member 1305023114-Feb-20 5:35 
AnswerRe: VfW Saving Compression Options Pin
Richard MacCutchan14-Feb-20 6:01
mveRichard MacCutchan14-Feb-20 6:01 
GeneralRe: VfW Saving Compression Options Pin
Member 1305023114-Feb-20 11:58
Member 1305023114-Feb-20 11:58 
GeneralRe: VfW Saving Compression Options Pin
Richard MacCutchan14-Feb-20 22:28
mveRichard MacCutchan14-Feb-20 22:28 

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.