Jan 17, 2012 at 10:29am UTC
Can someone help me with this.You said that for repeating program I use do-while,and when I say at the end of the program
cout << " Do you want to continue y/n : ";
I put that inside of while() but every time that program repeats like milion times ? HELP
Jan 17, 2012 at 1:16pm UTC
Please copy full cycle code to codepad.org and give us a link
Jan 17, 2012 at 2:57pm UTC
you have the condition in the while loop wrong.
"ope = 'n' " writes the character into the variable so its always true/possible and therefore an infinite loop.
you need to use either the operator "==" (which should work for chars but not sure now) or if you are using Strings the strcmp() method.
edit: also you have a strange method of putting the brackets, its hard to locate them in your code so maybe you can make them more visible by putting them in an own line.
Last edited on Jan 17, 2012 at 4:13pm UTC
Jan 17, 2012 at 4:01pm UTC
Thanks for that and one more question. In that link why does it say "Line 7: error: '_TCHAR' has not been declared " don't get that ?
Jan 17, 2012 at 4:15pm UTC
do you have that error in your compiler or was it automatically added when you uploaded the file? (dont know much about codepad)
if its in your compiler, what OS are you using and what IDE (if you are using one)
Jan 17, 2012 at 4:36pm UTC
Its shows when I put it in codepad
Jan 17, 2012 at 6:14pm UTC
Sometimes in certain editors there are invisible characters.
Becareful.
Jan 17, 2012 at 8:15pm UTC
well then I can only assume that codepad has something like a built in compiler which doesnt recognize the datatype _TCHAR for whatever reason.
I would suggest that you ignore that as long as it is working fine on your PC.
Jan 17, 2012 at 11:07pm UTC
and why does it say that var ope is being used without initialization,how to fix that
Jan 17, 2012 at 11:12pm UTC
have you declared it as int ope, or long ope, char ope, string ope, float ope?
Jan 17, 2012 at 11:55pm UTC
Thank you people,my program finnaly works as I wanted :)