⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 9_2.cpp

📁 闯城堡游戏。城堡中设有一些房间和一些陷阱
💻 CPP
📖 第 1 页 / 共 2 页
字号:
     return doyouquit();
}
else if (x == 2)
{
     cout << trapped();
}
else if (x == 3)
{
     cout << "\nYou feel something soft against the wall.  Not being sure what,";
     cout << "it is you decide to leave it alone.\n\n";
     system("pause");
     return dungeon2();
}
else if (x == 4)
{
     cout << "THE DOOR IS LOCKED!!!\n\n";
     system("pause");
     return dungeon2();
}
else if ((x != 1) || (x != 2) || (x != 3) || (x != 4))
{
     return doyouquit();
}
}
char trapped()
  {
     int x;
     cout << "Making your way through the dungeon.  You go east through an open door.\n";
     cout << "The door closes behind you.  \"What\'s up with the closing doors\?\"\n";
     cout << "You ask yourself.  All of a sudden the ceiling starts moving towards you.\n";
     cout << "Your certain to be crushed unless you do something, but what\?\n";
     cout << "You see two levers on your right .... Which one to pull\?  Or should\n";
     cout << "you try one of the two doors\?\n";
     cout << "Where do you want to do?\n";
     cout << "(1) Pull the lever on the left: \n";
     cout << "(2) Pull the lever on the right: \n";
     cout << "(3) Back the way you came: \n";
     cout << "(4) Try the door to your right: \n";
     cin >> x;
if (x == 1)
{
     cout << "You pull the lever on the left, but nothing happens.\n";
     cout << "You are slowly crushed by the ceiling.\n\n";
     system("pause");
     return doyouquit();
}
else if (x == 2)
{
     cout << "You pull the lever on the right, the door swings open.\n";
     cout << "Not being one to waste time you hurry through.\n\n\n";
     system("pause");
     return roomtwowest();
}
else if (x == 3)
{
     cout << "You try the door but it\'s locked.  Of course it\'s locked\n";
     cout << "you tell yourself as you go to hit your head.  But the ceiling\n";
     cout << "beats you to it!\n\n";
     system("pause");
     return doyouquit();
}
else if (x == 4)
{
     cout << "You try the door but it\'sl locked.  Of course it\'s locked\n";
     cout << "you tell yourself as you go to hit your head.  But the ceiling\n";
     cout << "beats you to it!\n\n";
     system("pause");
     return doyouquit();
}
else if ((x != 1) || (x != 2) || (x != 3) || (x != 4))
{
     return doyouquit();
}
}
char roomthreeeast()
{
     int x;
     cout << "As you step into the Eastern-most room of the Castle you notice\n";
     cout << "that the room is completely empty, no doors, windows, or even a \n";
     cout << "description for that matter.  The programmer must have been pretty\n";
     cout << "tired when he got to this room.\n";
     cout << "What do you want to do?\n";
     cout << "(1) West: \n";
     cout << "(2) Kill yourself: \n";
     cin >> x;
if (x == 1)
{
     cout << "\n\n\n";
     return roomtwoeast();
}
else if (x == 2)
{
   cout << "Someone has a self-esteem problem.  Did you really think it would\n";
     cout << "be that easy?\n\n\n";
     system("pause");
     return roomthreeeast2();
}
}
char roomthreeeast2()
{
     int x;
     cout << "Regretfully, you're still here. And no, the programmer has not had his coffee\n";
     cout << "se the room is still completely empty, no doors, windows, or even a \n";
     cout << "description for that matter, just like last time.\n";
     cout << "What do you want to do?\n";
     cout << "(1) West: \n";
     cout << "(2) Kill yourself: \n";
     cin >> x;
if (x == 1)
{
     cout << "\n\n\n";
     return roomtwoeast();
}
else if (x == 2)
{
   cout << "I thought we had talked about this already?\n";
     system("pause");
     return roomthreeeast2();
}
}

char backdoor()
{
     int x;
     cout << "It was a back door after all!  You're outside!\n";
     cout << "You find yourself in a courtyard surrounded by 20 ft walls.\n";
     cout << "There are two doors, East and South.\n";
     cout << "Where do you want to go?\n";
     cout << "(1) West: \n";
     cout << "(2) East: \n";
     cout << "(3) North: \n";
     cout << "(4) South: \n";
     cin >> x;
if (x == 1)
{
     cout << "\n\n";
     return roomtwonorth();
}
else if (x == 2)
{
     cout << "For the fun of it you try to climb the wall.\n";
     cout << "Brushing the bushes aside first, you find a secret passage!\n";
     cout << "\n\n";
     system("pause");
     return outside2();
}
else if (x == 3)
{
     cout << "For the fun of it you try to climb the wall.\n";
     cout << "Your almost to the top when you loose your footing and fall.\n";
     cout << "Get the asprin...\n\n\n";
     return bravesoul();
}
else if (x == 4)
{
     cout << "\n\n";
     return roomtwoeast();
}
else if ((x != 1) || (x != 2) || (x != 3) || (x != 4))
{
   cout << "\n\n";
     return doyouquit();
}
}
char fireplace()
{
     int x;
     cout << "You enter the room and right away notice how warm it is. \n";
     cout << "To the East is the door you just came through.  To the West is a cozy\n";
     cout << "looking fireplace.  The wood logs look brand new, someone must have just\n";
     cout << "placed them on.  Other than that, there is not much else to look at.\n";
     cout << "What do you want to do?\n";
     cout << "(1) East: \n";
     cout << "(2) West: \n";
     cout << "(3) Roast Marshmellows: \n";
     cin >> x;
if (x == 1)
{
     cout << "I don't think burning yourself in the fire is a good idea.  But hey,\n";
     cout << "it's your life!\n\n";
     system("pause");
     return fireplace2();
}
else if (x == 2)
{
     cout << "\n\n";
     return parlor();
}
else if (x == 3)
{
  cout << "\n\n";
  cout << "You wished you had some marshmellows right now.  Maybe if you find your way\n";
  cout << "out of here you can run to the store and come back.\n\n";
  system("pause");
  return fireplace2();
}

else if ((x != 1) || (x != 2) || (x != 3))
{
     return doyouquit();
}
}
char fireplace2()
{
     int x;
     cout << "You're in the study. \n";
     cout << "To the East is the door you just came through.  To the West is a cozy\n";
     cout << "looking fireplace.  The fire is starting to dwindle, maybe you should\n";
     cout << "put one on?  Other than that, there is not much else to look at.\n";
     cout << "What do you want to do?\n";
     cout << "(1) East: \n";
     cout << "(2) West: \n";
     cout << "(3) Roast Marshmellows: \n";
     cin >> x;
if (x == 1)
{
     cout << "Well wouldn't you know it!  Cotton IS flamable.\n\n";
     system("pause");
     return bravesoul();
}
else if (x == 2)
{
     cout << "\n\n";
     return parlor();
}
else if (x == 3)
{
  cout << "\n\n";
cout << "You wished you had some marshmellows right now.  Maybe if you find your way\n";
  cout << "out of here you can run to the store and come back.\n\n";
  system("pause");
  return fireplace2();
}
else if ((x != 1) || (x != 2) || (x != 3))
{
     return doyouquit();
}
}
char parlor()
{
     int x;
     cout << "You enter into the parlor.  You know it's the parlor becuase the welcome\n";
     cout << "mat said so.  There are plenty of doors to try in this room.  North, South,\n";
     cout << "East, and West.\n";
     cout << "Which way do you want to go?\n";
     cout << "(1) South: \n";
     cout << "(2) North: \n";
     cout << "(3) East:  \n";
     cout << "(4) West: \n";
     cin >> x;
if (x == 1)
{
     cout << "\n\n";
     return roomtwonorth();
}
else if (x == 2)
{
     cout << "\n\n";
     return outside2();
}
else if (x == 3)
{
     cout << "\n\n";
     return fireplace();
}
else if (x == 4)
{
     cout << "\n\n";
     return easttower();
}
else if ((x != 1) || (x != 2) || (x != 3) || (x != 4))
{
     cout << "\n\n";
     return doyouquit();
}
}
char easttower()
{
     int x;
     cout << "You climb up a large flight of circular stairs. \n";
     cout << "You find yourself in a small circular room with one window\n";
     cout << "in the front.  There is a spectacular view of the far off city.\n";
     cout << "And look!  There's your broken down car.  Damn car.";
     cout << "Where do you want to go?\n";
     cout << "(1) South: \n";
     cout << "(2) Look further out the window: \n";
     cin >> x;
if (x == 1)
{
     cout << "\n\n";
     return parlor();
}
else if (x == 2)
{
     cout << "You knew you were asking for it when you thought of the option!\n";
     cout << "You try and get a better look of you car but end up getting an up\n";
     cout << "close look at the mail box.  Was white, and had a nice flag....\n\n";
     return bravesoul();
}
else if ((x != 1) || (x != 2))
{
     cout << "\n\n";
     return doyouquit();
}
}
char outside2()
{
     cout << "You're free!! You made it!!! You're free!!!\n";
     cout << "You wipe your forehead, glad that it's over.\n";
     cout << "\n\n\n";
     cout <<"*---------------------------------------------------*\n";
     cout <<"| Thanks for playing, I hope you enjoyed the game!  |\n";
     cout <<"| Giving credit where credit is due, I got the idea |\n";
     cout <<"| from a game I played on a Unix server.  I couldn't|\n";
     cout <<"| win so I decided to make one that I could.        |\n";
     cout <<"| This game was created with Bloodshed's Dev / C++  |\n";
     cout <<"| carter@mcarterbrown.com                           |\n";
     cout <<"*---------------------------------------------------*\n\n\n";
     system("pause");
     return 0;
}
char bravesoul()
{
     cout << "\n\n\nYou took a wrong turn.  But don't die in vain, try again!\n\n\n";
     system("pause");
     return doyouquit();
}
char roomone2()
{
     int x;
     cout << "\nYou are in the entrance way of the Castle.\n";
     cout << "There are 3 doors, one to the North, East, and West.\n\n";
     cout << "Where do you want to go?\n";
     cout << "(1) North: \n";
     cout << "(2) East: \n";
     cout << "(3) West: \n";
     cout << "(4) South: \n";
     cout << "(5) Look around: \n";
     cin >> x;
if (x == 1)
{
     cout << roomtwonorth();
}
else if (x == 2)
{
     cout << roomtwoeast();
}

else if (x == 3)
{
     cout << roomtwowest();
}
else if (x == 4)
{
     cout << "That door is locked.\n";
     cout << "Why are you trying again?\n\n";
     system("pause");
     return roomone();
}
else if (x == 5)
{
     return roomone();
}
else if ((x != 1) || (x != 2) || (x != 3) || (x != 4) || (x != 5))
{
     return doyouquit();
}
}
char outside3()
{
      int x;
      cout << "You are standing in front of the castle, now with a rather large\n";
      cout << "bump on your head.  It really stings.\n";
      cout << "Next to you is a mailbox.  The castle is to the north.\n";
      cout << "What do you want to do\?\n";
      cout << "(1) North: \n";
      cout << "(2) East:  \n";
      cout << "(3) West: \n";
      cout << "(4) South: \n";
      cout << "(5) Look inside Mailbox: \n";
      cin >> x;
if (x == 1)
{
     cout << roomone();
}
else if (x == 2)
{
    cout << "\nOUCH!  You run into a tree!\nTry again.\n\n";
      system("PAUSE");
      return outside3();
}
else if (x == 3)
{
     cout << "You can not go that way. \n\n";
     system("PAUSE");
     return outside();
}
else if (x == 4)
{
 cout << "You sink into the swamp!\n\nNext time you should be more careful.\n\nEnd Game\n\n";
 system("PAUSE");
 return doyouquit();
}
else if (x == 5)
{
     cout << "*------------------------------------------------*\n";
     cout << "| Thank you for trying and playing The Castle    |\n";
     cout << "| By M. Carter Brown, written in C++             |\n";
     cout << "|                                                |\n";
     cout << "| The object of this game is simply to get       |\n";
     cout << "| through the castle alive.                      |\n";
     cout << "| Good Luck!                                     |\n";
     cout << "|                           - M. Carter Brown    |\n";
     cout << "*------------------------------------------------*\n";
     cout << "\n\n\n\n";
     system("PAUSE");
     return outside();
}
else if ((x != 1) || (x != 2) || (x != 3) || (x != 4) || (x != 5))
{     return doyouquit();
}
}
char doyouquit()
{
   int x;
   cout << "\n\nDo you want to play again? \n";
   cout << "(1) To Start Over:\n";
   cout << "(2) To Quit:\n";
   cin >> x;
if (x == 1)
{
cout << "\n\nGood Choice!\n\n\n";
return main();
}
else
{
return 0;
}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -