I started making this text adventure. It very very short currently. I am new to programming and this is my first go at an actual program. I am open to critisism about my code, organization, style, etc...
// Text Adventure
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
//Variables--------------------------------------------------------------------------------
string charactersfirstname;
string characterslastname;
int chapter1;
int chapter2;
//Intro
cout << "Devyn's Text Adventure" << endl << endl;
system("PAUSE");
system("CLS");
//Get Players Name-------------------------------------------------------------------------
cout << "Please enter your character's first name." << endl;
cin >> charactersfirstname;
system("CLS");
cout << "Please enter your character's last name." << endl;
cin >> characterslastname;
system("CLS");
cout << "Your characters name is " << charactersfirstname;
cout <<" " << characterslastname << "." << endl;
system("PAUSE");
system("CLS");
//Get Players Gender------------------------------------------------------------------------
chooseGender:
system("CLS");
string playersGender;
cout << "What gender are you? Enter 'male' or 'female'." << endl;
cin >> playersGender;
system("CLS");
if (playersGender == "male") {
cout << "You chose male." << endl;
system("PAUSE");
system("CLS");
}
elseif (playersGender == "female") {
cout << "You chose female." << endl;
system("PAUSE");
system("CLS");
}
else {
cout << "You must enter either 'male' or 'female'." << endl;
system("PAUSE");
goto chooseGender;
}
//Select Chapter To Play
int getchaptertoplay;
selectchapter:
system("PAUSE");
system("CLS");
cout << "Please Select the chapter you would like to play by entering the chapter number." << endl << endl;
cout << "Chapter 1 (Nameless) Chapter 2 (Comming Soon)" << endl;
cin >> getchaptertoplay;
if (getchaptertoplay == 1) {
system("CLS");
goto chapteroneplay;
}
elseif (getchaptertoplay == 2) {
system("CLS");
cout << "Chapter 2 is coming soon. Please select a different chapter." << endl;
system("PAUSE");
goto selectchapter;
}
else {
system("CLS");
cout << "Please select a valid chapter." << endl;
system("PAUSE");
goto selectchapter;
}
//Chapter 1
chapteroneplay:
system("CLS");
cout << "You chose chapter one." << endl;
cout << "Lets get started..." << endl;
system("PAUSE");
goto dialog_1_start;
//Dialog 1__________________________________________________________________________________________________________________
dialog_1_start:
string dialog1;
system("CLS");
cout << "You wake up. You feel exausted, along with a major head rush." << endl << "Choices:" << endl;
cout << "A) Stand up quickly. B) Stand up slowly." << endl << endl;
cin >> dialog1;
//Dialog 1 Choice A
if (dialog1 == "a") {
system("CLS");
cout << "You stand up quickly, but not before callapsing straight onto the cold metal floor. *Clank!*" << endl << endl;
cout << "You slowly get back to your feet and glance at your surroundings." << endl;
cout << "The room is dark, with your eyes not quite adjusting to the darkness." << endl << endl << endl;
system("PAUSE");
system("CLS");
cout << "*BLEEP*..*BLEEP*..*BLEEP*..." << endl << endl;
system("PAUSE");
system("CLS");
cout << "*BLEEP*..*BLEEP*..*BLEEP*..." << endl << endl;
system("PAUSE");
system("CLS");
cout << "The noise is coming from across the room. You walk to the area the noise is echoing from." << endl;
cout << "There is a desk cluttered with papers, with a keyboard buried underneath them." << endl << endl;
system("PAUSE");
// goto dialog_1_a;
}
//Dialog 1 Choice B
elseif (dialog1 == "b") {
system("CLS");
cout << "You take your time getting up. The head rush goes away and your vision is clear." << endl;
cout << "You notice its cold, and you feel alone in the dark, empty room." << endl;
cout << "*BLEEP*..*BLEEP*..*BLEEP*..." << endl << endl;
system("PAUSE");
system("CLS");
cout << "*BLEEP*..*BLEEP*..*BLEEP*..." << endl << endl;
system("PAUSE");
system("CLS");
cout << "The noise is coming from across the room. You walk to the area the noise is echoing from." << endl;
cout << "There is a desk cluttered with papers, with a keyboard buried underneath them." << endl;
system("PAUSE");
// goto dialog_1_b;
}
//Dialog 1 END____________________________________________________________________________________________________________________
return 0;
}