1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
#include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
int noteNumber, exit = 0;
char input[5], str[256], mapName[30], mapNameInput[30], creatorName[15], creatorNameInput[15];
ifstream rules("rules.txt");
ifstream note1("note 1.txt");
ifstream note2("note 2.txt");
ifstream map("map.txt");
ifstream creator("creator.txt");
while(exit == 0)
{
cout << "Welcome to ";
map.clear();
map.seekg(0);
while(map.getline(mapName, 30))
cout << mapName;
cout << " Adventure Map. \nThis Map was made by ";
creator.clear();
creator.seekg(0);
while(creator.getline(creatorName, 15))
cout << creatorName;
cout << ".\nThis application was made by Aaron Walwyn.\n\n"
<< "To read a Note type 'Note' \nTo read the Rules tye 'Rules' \nTo exit Type 'Exit'"
<< "\n\nInput: ";
cin >> input;
cout << "\n";
if ((strcmpi(input,"note")==0))
{
cout << "Note: ";
cin >> noteNumber;
cout << "\n";
switch(noteNumber)
{
case 1:
note1.clear();
note1.seekg(0);
while(note1.getline(str, 256))
cout << str << "\n";
break;
case 2:
note2.clear();
note2.seekg(0);
while(note2.getline(str, 256))
cout << str << "\n";
break;
default:
cout << "\n\nThat is not a valid note number, please try again...\n\n";
}
}
else if ((strcmpi(input,"rules")==0)) //Rules
{
rules.clear();
rules.seekg(0);
while(rules.getline(str, 256))
cout << str << "\n";
}
else if ((strcmpi(input,"devmode")==0)) //Dev Mode
{
int devExit, passcheck;
devExit = 0;
passcheck = 0;
while(devExit==0)
{
ofstream map("map.txt");
char passEnter[30];
int devMenu;
if (passcheck==0)
{
cout << "DEV MODE is password protected, please enter the password: ";
cin >> passEnter;
passcheck==1;
}
if ((strcmp(passEnter,"default")==0)) //password is entered here
{
system("CLS");
cout << "DEV MODE\n\n"
<< "Select a menu option by typing the number\n"
<< "1) Rename Map\n"
<< "2) Create New Note\n"
<< "3) Create Map Rules\n"
<< "4) Change creator name\n"
<< "5) Change DEV MODE password\n";
cout << "\nMenu Choice: ";
cin >> devMenu;
switch(devMenu)
{
case 1:
cout << "\nType what goes as the map name: ";
cin >> mapName;
map << mapNameInput;
break;
case 2:
cout << "New note function goes here\n";
break;
case 3:
cout << "Rules functions goes here\n";
break;
case 4:
cout << "\nType the creator's name: ";
cin >> creatorName;
map << creatorNameInput;
break;
default:
devExit = 1;
}
}
passcheck = 0;
}
}
else if ((strcmpi(input,"exit")==0)) //Exit
{
exit=1;
}
}
/*cout << "\n\n";
system("PAUSE");
system("CLS"); */
}
note1.close();
note2.close();
rules.close();
map.close();
cout << "Thanks for using this feature \nThis software was made by Aaron Walwyn. \nwww.youtube.com/actionmanmedia \nDo not distribute.\n\n";
system("PAUSE");
return EXIT_SUCCESS;
}
|