Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <fstream>
- #include <string>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- void splashScreen();
- void login();
- void command();
- void startzone();
- void currentposition();
- void encounter();
- char userCommand[22];
- int main()
- {
- ifstream inputData;
- inputData.open("data.txt");
- splashScreen();
- login();
- startzone();
- command();
- if( _stricmp("walk north", userCommand))
- {
- encounter();
- }
- else if(_stricmp("walk east", userCommand))
- {
- cout << "Fail." << endl;
- }
- else if(_stricmp("walk south", userCommand))
- {
- cout << "Fail." << endl;
- }
- else if(_stricmp("walk west", userCommand))
- {
- cout << "Fail. Its locked. " << endl;
- }
- }
- void splashScreen()
- {
- cout << "================================================" << endl;
- cout << "== ________ ==" << endl;
- cout << "== | o __ o | Title ==" << endl;
- cout << "== \\_ __ _/ ==" << endl;
- cout << "== __ | | __ ==" << endl;
- cout << "== ************** ==" << endl;
- cout << "================================================" << endl;
- }
- void login()
- {
- string userName, userPass;
- cout << "Username: ";
- cin >> userName;
- cout << "Password: ";
- cin >> userPass;
- //check userName to username in file
- //check userPass to password in file
- }
- void command()
- {
- cout << ">> ";
- cin >> userCommand;
- }
- void startzone()
- {
- cout << "You are in the center of a foggy forest. There is a marshy \n"
- << "swamp to the South. To the East lies a thick line of bushes.\n"
- << "To the North through a winding path you catch a glimpse of a\n"
- << "cave with a shinng light coming out. To the West is a small\n"
- << "wooden shack, with a locked door. " << endl;
- }
- void encounter()
- {
- srand(time(0));
- int num = rand() % 10 + 1;
- switch(num)
- {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- cout << "STOMP! A giant stone golem almost flattened you, luckily you halted an \n"
- << "inch short of his foot as it fell. He begins to raise his leg again \n"
- << "for another bash." << endl;
- command();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement