Click here to Skip to main content
15,902,736 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Conversion... Pin
ravjak25-Mar-04 6:47
ravjak25-Mar-04 6:47 
GeneralProblem with COleDateTime Pin
PravinSingh24-Mar-04 21:40
PravinSingh24-Mar-04 21:40 
GeneralRe: Problem with COleDateTime Pin
Cedric Moonen24-Mar-04 21:48
Cedric Moonen24-Mar-04 21:48 
GeneralRe: Problem with COleDateTime Pin
David Crow25-Mar-04 2:41
David Crow25-Mar-04 2:41 
GeneralEnums Pin
monrobot1324-Mar-04 21:22
monrobot1324-Mar-04 21:22 
GeneralRe: Enums Pin
Anonymous24-Mar-04 21:32
Anonymous24-Mar-04 21:32 
GeneralRe: Enums Pin
Maxwell Chen24-Mar-04 21:52
Maxwell Chen24-Mar-04 21:52 
GeneralRe: Enums Pin
David Crow25-Mar-04 2:48
David Crow25-Mar-04 2:48 
GeneralRe: Enums Pin
monrobot1325-Mar-04 18:33
monrobot1325-Mar-04 18:33 
Generalimproving a hack Pin
axid3j1al24-Mar-04 20:25
axid3j1al24-Mar-04 20:25 
QuestionHow to popup the application-menu ? Pin
ohadp24-Mar-04 20:16
ohadp24-Mar-04 20:16 
GeneralError in calling DLL Pin
dafan24-Mar-04 19:14
dafan24-Mar-04 19:14 
GeneralRe: Error in calling DLL Pin
dafan25-Mar-04 2:41
dafan25-Mar-04 2:41 
GeneralA Loop...homework tips please! Pin
Joe Estes24-Mar-04 18:27
Joe Estes24-Mar-04 18:27 
GeneralRe: A Loop...homework tips please! Pin
Roger Wright24-Mar-04 19:54
professionalRoger Wright24-Mar-04 19:54 
GeneralRe: A Loop...homework tips please! Pin
Prakash Nadar24-Mar-04 20:16
Prakash Nadar24-Mar-04 20:16 
GeneralRe: A Loop...homework tips please! Pin
Roger Wright24-Mar-04 20:46
professionalRoger Wright24-Mar-04 20:46 
GeneralRe: A Loop...homework tips please! Pin
Prakash Nadar24-Mar-04 20:54
Prakash Nadar24-Mar-04 20:54 
GeneralRe: A Loop...homework tips please! Pin
Roger Wright24-Mar-04 21:00
professionalRoger Wright24-Mar-04 21:00 
GeneralRe: A Loop...homework tips please! Pin
peterzorbas24-Mar-04 21:40
peterzorbas24-Mar-04 21:40 
well my suggestion would be as follows.
int someFuntion(){
for(;;)// causes to loop infinite times, its 2 semicolons.
{
if(gets(c)=='x'){
return 0; //or break; /*breaks out of loop.*/
}
else{
keep going;
}
return 0;
}
i think the above is not a good model and is only necessary when nothing else would work. It is said that a clean program should have 1 entry point and 1 exit point. This does not follow that guideline.

the thing is there are so many things you can do with this.
such as

while(done!=1){
cin>>command;
if(command!='x')
{
done=0;
}
else
do more;
}


Also here is your problem. When you cin you recieve a string once you press the enter button. When you use the function toLower() in the ctype library you are comparing 1 char value. i think this would cause a segmentation fault(exception) if the user types XX by mistake. if you wish for 1 char then i think it would be appropriate to use something like getchar() or getch() not sure what the proper name is but use that instead. When you use C++ don't forget that C is a big part of the C++ language. It was necessary for C++ to be a superset of C simply because of simplification.

http://www-ccs.ucsd.edu/c/
GeneralRe: A Loop...homework tips please! Pin
peterzorbas24-Mar-04 21:58
peterzorbas24-Mar-04 21:58 
GeneralRe: A Loop...homework tips please! Pin
peterzorbas24-Mar-04 21:57
peterzorbas24-Mar-04 21:57 
GeneralRe: A Loop...homework tips please! Pin
Paul Ranson25-Mar-04 2:35
Paul Ranson25-Mar-04 2:35 
GeneralRe: A Loop...homework tips please! Pin
Roger Wright25-Mar-04 5:55
professionalRoger Wright25-Mar-04 5:55 
GeneralRe: A Loop...homework tips please! Pin
Paul Ranson25-Mar-04 6:42
Paul Ranson25-Mar-04 6:42 

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.