Advertisement
Guest User

Untitled

a guest
Aug 11th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.25 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <fstream>
  4. #include <string>
  5. #include <cstdlib>
  6. #include <ctime>
  7. using namespace std;
  8.  
  9. void splashScreen();
  10. void login();
  11. void command();
  12. void startzone();
  13. void currentposition();
  14. void encounter();
  15. char userCommand[22];
  16.  
  17. int main()
  18. {
  19.     ifstream inputData;
  20.     inputData.open("data.txt");
  21.  
  22.     splashScreen();
  23.     login();
  24.     startzone();
  25.     command();
  26.     if( _stricmp("walk north", userCommand))
  27.     {
  28.         encounter();
  29.     }
  30.     else if(_stricmp("walk east", userCommand))
  31.     {
  32.         cout << "Fail." << endl;
  33.     }
  34.     else if(_stricmp("walk south", userCommand))
  35.     {
  36.         cout << "Fail." << endl;
  37.     }
  38.     else if(_stricmp("walk west", userCommand))
  39.     {
  40.         cout << "Fail. Its locked. " << endl;
  41.     }
  42. }
  43.  
  44. void splashScreen()
  45. {
  46.     cout << "================================================" << endl;
  47.     cout << "==       ________                             ==" << endl;
  48.     cout << "==      | o __ o |        Title               ==" << endl;
  49.     cout << "==       \\_ __ _/                             ==" << endl;
  50.     cout << "==      __ |  | __                            ==" << endl;
  51.     cout << "==    **************                          ==" << endl;
  52.     cout << "================================================" << endl;
  53. }
  54. void login()
  55. {
  56.     string userName, userPass;
  57.     cout << "Username: ";
  58.     cin >> userName;
  59.     cout << "Password: ";
  60.     cin >> userPass;
  61.     //check userName to username in file
  62.     //check userPass to password in file
  63. }
  64. void command()
  65. {
  66.     cout << ">> ";
  67.     cin >> userCommand;
  68. }
  69. void startzone()
  70. {
  71.     cout << "You are in the center of a foggy forest. There is a marshy \n"
  72.         << "swamp to the South.  To the East lies a thick line of bushes.\n"
  73.         << "To the North through a winding path you catch a glimpse of a\n"
  74.         << "cave with a shinng light coming out. To the West is a small\n"
  75.         << "wooden shack, with a locked door. " << endl;
  76. }
  77. void encounter()
  78. {
  79.     srand(time(0));
  80.     int num = rand() % 10 + 1;
  81.     switch(num)
  82.     {
  83.     case 1:
  84.     case 2:
  85.     case 3:
  86.     case 4:
  87.     case 5:
  88.     case 6:
  89.     case 7:
  90.     case 8:
  91.     case 9:
  92.     case 10:
  93.         cout << "STOMP! A giant stone golem almost flattened you, luckily you halted an \n"
  94.             << "inch short of his foot as it fell. He begins to raise his leg again \n"
  95.             << "for another bash." << endl;
  96.         command();
  97.     }
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement