ok so many times i have been helped by you guys (and girls) and so many times have i thought "should be smooth sailing from here" and i always run into another problem well here is my code
what i want to happen is when you get dont reading the theory you can type game and it will start the game text the only way i could think was to make another variable and make that one the same as whatyoutype2 i would like it to just be able to execute whatyoutype2 == "game" but i dont know how if thats not possible (and i think it is) all that happens when you get done reading the theory is the program closes i tried using system("pause"); but that just paused the program then closed it also the cout is taking up a lotta space so if anyone knows one command that will let me put out a lot of text that would be cool also. anyother sudgestions would be nice but thats my problem i been workin on it for about a week i am a n00b badly but whatever everyone starts somewhere.Code:#include <iostream> #include <string> using namespace std; int main(void) { string whattheytype; string whattheytype2; string whattheytype3; string commands = "commands"; string option1 = "start"; string theory = "theory";/*variables*/ string game ="game"; string leave = "exit"; int pause; int more; std::cout<<"this game was ripped off from the choose your own adventure\n"; std::cout<<" book called Undergound Kingdom by Edward Packard\n"; std::cout<<"ok this is a choose your own adventure game called\n"; std::cout<<"Underground kingdom. you will read the page then you will be\n"; std::cout<<"asked to choose which way you want to go and such\n"; std::cout<<"sounds like fun huh? thought so. ok type commands to\n"; std::cout<<"get a list of commands. and type exit to leave";/* all this is is the introductory for the game*/ std::cout<<"\ntype start to start the game!\n"<<endl; std::cin>>whattheytype;/* beginning commands*/ if (whattheytype == commands) { std::cout<<"just follow the instructions and restart the program\n"<<endl;/*insructions*/ } else if (whattheytype == "exit") { std::cout<<"goodbye\n"; } else if (whattheytype != "start") { std::cout<<"that is not a command restart the game\n"; } else if (whattheytype == "start")/*beginning of actual game*/ { std::cout<<"WARNING!!!!!!!!!!!!!\n"; std::cout<<"\n"<<endl; std::cout<<"The Underground Kingdom is not easy to reach. Many Players\n"; std::cout<<"never get ther. Others never return.\n"; std::cout<<" Before starting out on your journey, you may want to read\n"; std::cout<<"Professor Bruckner's theory, which is set fourth on the next block\n"; std::cout<<"of text.\n"; std::cout<<" Professor Bruckner is a rather boring writer, and i wouldn't\n"; std::cout<<"suggest that you bother read his theory exept that, if you ever\n"; std::cout<<"get to the Underground Kingdom, it might save your life. Good luck!\n"<<endl; std::cout<<"type theory to read the theory type game to start the game\n"; } std::cin>>whattheytype2; if (whattheytype2 == "game") { std::cout<<"game would go here\n"; system("pause"); } else if (whattheytype2 == "theory") { std::cout<<" PROFESSOR\n"; std::cout<<" BRUCKNER'S\n"; std::cout<<" THEORY\n"; std::cout<<"---------------------------------------------------------------\n"; std::cout<<"The discovery of the Bottomless Crevasse in Greenland by Dr. Nera \n"; std::cout<<"Vivaldi supports my therory that the earth is not solid, as has\n"; std::cout<<"been thought, but that it is hollow. The Bottomless Crevasse is\n"; std::cout<<"probably the sole route from the earth's surface to a vast Underground\n"; std::cout<<"Kingdom. The only other possible link would be an underground river,\n"; std::cout<<"flowing in alternating directions in response to the tides, but this \n"; std::cout<<"seems unlikely.\n"; std::cout<<"How you may ask, was the earth hollowed out? My studies show that more\n"; std::cout<<"than a billion years ago a tiny blck hole collided with out planet and\n"; std::cout<<"lodged in its center, pulling the whole molten core into an incredibly\n"; std::cout<<"massive sphere only a few hundred meter across.\n"; std::cout<<"If you were to stand on the inner surface of the earth, like a fly on the\n"; std::cout<<"shell of an enormous pumpkin, you would see the black hole directly overhead,\n"; std::cout<<"press any key and hit enter for more of the theory\n"; std::cin>>more; std::cout<<"like a black sun.\n"; std::cout<<"The Gravity of the earth's thick shell would hold you to the inner shell\n"; std::cout<<"of the earth, though you would weigh much less than you would on the\n"; std::cout<<"outer surface because the mass of the Black Sun would tend to pull \n"; std::cout<<"you toward it. If there were a very tall mountain in the Underground\n"; std::cout<<"Kingdom and you were to climb to the top of it, you might be pulled\n"; std::cout<<"up into the Black Sun because gravity gets stronger as you approach\n"; std::cout<<"a massive object.\n"; std::cout<<"In all other respects the Black Sun would not be dangerous to any creatures\n"; std::cout<<"in the Unerground Kingdom. On the contrary, the Black Sun would be\n"; std::cout<<"necessary to life in th underworld, but in the opposit way that the sun is\n"; std::cout<<"necessary to life on the earth's surface. OUr sun give us heat and keeps us\n"; std::cout<<"from freezing. The Black Sun absorbs heat. If there is an underground \n"; std::cout<<"kingdom, it is the Blac Sun tha keep its inhabitants from being baked to\n"; std::cout<<"death by the heat within the earth.\n"; std::cout<<"type game to start the game\n"; std::cin>>whattheytype3; } if (whattheytype3 == "game") { std::cout<<"game would go here"; } else if (whattheytype3 != "game") { std::cout<<"i dont understand"; } return 0; }



LinkBack URL
About LinkBacks


