So when are we moving on to conquest, boys?Originally Posted by The_Doctor
Don't spoil my fun, hey!
So when are we moving on to conquest, boys?Originally Posted by The_Doctor
Don't spoil my fun, hey!
Nothing appears to be wrong with that code in your first post apart from the booleans need to be initialised.
“The majestic equality of the laws prohibits the rich and the poor alike from sleeping under bridges, begging in the streets and stealing bread.” - Anatole France
"The law is like a spider’s web. The small are caught, and the great tear it up.” - Anacharsis
There is. He wants loops, but his while loops don't do anything, because they end in a semicolon. His code IS, both syntactically, and semantically, correct, yes, but I very much doubt that was what he wanted (while loops that do nothing), at least from what he explained.Originally Posted by Manco Capac
Therapy helps, but screaming obscenities is cheaper.
I've just spotted that!Originally Posted by Blodrast
So without the semicolons and, if the booleans are initialised it should work? (bear in mind it has been a long time, and I am more C than C++ !) e.g.
???Code:#include <iostream.h> int main() { bool Easy=false; bool Medium=false; bool Hard=false; int Option=false; std::cout<< "Game intructions\n"; std::cout<< "Please select a difficulty level\n"; std::cout<< "1=Easy\n"; std::cout<< "2=Medium\n"; std::cout<< "3=Hard\n"; std::cout<< "4=Quit\n"; std::cin>> Option; if (Option == 1) { Easy = true; } if (Option == 2) { Medium = true; } if (Option == 3) { Hard = true; } if (Option == 4) { return 0; } while (Easy == true) { cout<< "Easy test works\n"; Easy = false; } while (Medium == true) { cout<< "Medium test works\n"; Medium = false; } while (Hard == true) { cout<< "Hard test works\n"; Hard = false; } return 0; }![]()
“The majestic equality of the laws prohibits the rich and the poor alike from sleeping under bridges, begging in the streets and stealing bread.” - Anatole France
"The law is like a spider’s web. The small are caught, and the great tear it up.” - Anacharsis
well, I'll be honest and I'll admit that I haven't actually tried the code - just looked at it.
But yeah, as far as I can tell, this should work just fine. Conceptually, it's correct, although it's always possible to miss a semicolon or some such.
Therapy helps, but screaming obscenities is cheaper.
Ok... I have had a second look...Originally Posted by Manco Capac
Manco Capac's code should work... if you initialise with a zero instead of false on the integer.
So, doc... you want to put a game in each of those loops?
Status Emeritus
![]()
A few posts ago I did say I got it working in university.![]()
Yes. It is scrambled word solving game. The program picks a word out of a list and scrambles it. Then the player must de-scramble it, one letter at a time. I have all the code for this, it is just a matter of intergreating it into my code.So, doc... you want to put a game in each of those loops?
Last edited by The_Doctor; 11-25-2006 at 17:51.
well, doc, let us know how it comes along :)
Sigurd: false IS zero- the wonders of C, eh ?
![]()
Therapy helps, but screaming obscenities is cheaper.
LoL. I think you install his mini-game, and pick "Medium". No one ever picks medium. Then 'the plan' is revealed.Originally Posted by LeftEyeNine
![]()
Be well. Do good. Keep in touch.
Bookmarks