| CODE |
| #include<iostream> using namespace std; main() {cout<<"Save the Princess!\nBy Kaz\nE to exit\n"; cout<<"Oh no the Princess has been kidnapped! You must go save her!\n"; cout<<"Will you save the Princess?\nY for yes, N for no\n"; char key; string event="choice"; bool end=false; while (event!="nothing") { cin>>key; if (key=='e' || key=='E') {exit(1);} if (event=="choice") { if (key=='y' || key=='Y') {cout<<"You leave the castle\n";event="river"; cout<<"You find yourself at a river. Will you try to jump it or make a raft?\nJ for jump, R for raft\n";} if (key=='n' || key=='N') {cout<<"You get tortured for not saving the Princess. You live the rest of your life in a dungeon.\n";system("pause");exit(1);} } if (event=="river") {if (key=='j' || key=='J') {cout<<"You try to jump it but fall into the river and drown. Game Over.\n";system("pause");exit(1);} if (key=='r' || key=='R') {cout<<"You make a raft and row across the river. You make it safely to the other side.\n";event="town"; cout<<"After a days walk you arrive at a town. Will you make sure you are going the right way by asking a villager?\nY for yes, N for no\n";} } if (event=="town") {if (key=='y' || key=='Y') {cout<<"The villager tells you which way to go. After resting for a few hours you head back on your journey. After some more walking you stop at a fork in the road. Which way will you go?\nL for left, R for right\n";event="path";} if (key=='n' || key=='N') {cout<<"You thank the villager and start walking. It seems you went the wrong way and fall off a cliff. Game Over.\n";system("pause");exit(1);} } if (event=="path") {if (key=='l' || key=='L') {cout<<"You walk along the road and find a hamster, he then eats you. Noob. Game Over.\n";system("pause");exit(1);} if (key=='r' || key=='R') {cout<<"You finally make it to the castle where the Princess is."; cout<<"Will you attack the guards or climb up the vines?\nA for attack, C for climb\n";event="castle";} } if (event=="castle") {if (key=='a' || key=='A') {cout<<"You use your kung fu skills and totally own the guards. You find the Princess and go home.\n";event="marriage"; cout<<"The Princess wants to marry you. Will you accept?\nY for yes, N for no\n";} if (key=='c' || key=='C') {cout<<"You climb up the vines but they break and you fall and break your neck.\nGame Over.\n";system("pause");exit(1);} } if (event=="marriage") {if (key=='y' || key=='Y') {cout<<"You get married and are unhappy the rest fo your life because you get nagged to death. Game Over.\n";system("pause");exit(1);} if (key=='n') {cout<<"You blow the Princess off and go to the brothel/hostel. The End\n";end=true;} } if (end==true) {cout<<"Coded by Kaz\nStory by Kaz\nMusic by Kaz\nGraphics by Kaz\n";system("pause");exit(1);} } } |
| CODE |
if (key=='e' || key=='E') { //do code } |