Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int state{ 1 };
- int main()
- {
- do {
- if (state == 1) {
- char firstChoice;
- cout << "Welcome to your story! You woke up in the middle of an abandoned town. You have two choices. They are: \n A) Explore the town for resources or B) Try to leave town \n";
- cin >> firstChoice;
- if (firstChoice == 'A' || firstChoice == 'a') {
- state = 2;
- }
- else if (firstChoice == 'B' || firstChoice == 'b') {
- state = 3;
- }
- }
- else if (state == 2) {
- char secondChoice;
- cout << "You've decided to explore the abandoned town! Here are your choices! You can take \n A) Medicial Supplies or B) Weapons for survival \n";
- cin >> secondChoice;
- if (secondChoice == 'A' || secondChoice == 'a') {
- state = 4; //Medicial Supplies
- }
- else if (secondChoice == 'B' || secondChoice == 'b') {
- state = 5; //Weapons for survival
- }
- }
- if (state == 3) {
- char otherChoice;
- cout << "You've decided to leave town! GAME OVER! Would you like to try again? Y/N? \n"; //GAME OVER
- cin >> otherChoice;
- if (otherChoice == 'Y' || otherChoice == 'y') {
- state = 1;
- }
- else {
- state = 0;
- }
- }
- else if (state == 4) {
- char thirdChoice;
- cout << "You decided to take Medicial Supplies! Here are your next choices! \n Do you want to: A) Continue exploring the town or B) Find a working car? \n";
- cin >> thirdChoice;
- if (thirdChoice == 'A' || thirdChoice == 'a') {
- state = 6; //Continue Exploring
- }
- else if (thirdChoice == 'B' || thirdChoice == 'b') {
- state = 7; //Find a working car
- }
- }
- if (state == 5) {
- char fourthChoice;
- cout << "You've decided to look for weapons! Would you like to: A) Go hunt for food or B) Camp out? \n";
- cin >> fourthChoice;
- if (fourthChoice == 'A' || fourthChoice == 'a') {
- state = 8; //Hunt for food
- }
- else if (fourthChoice == 'B' || fourthChoice == 'b') {
- state = 9; //Camp Out
- }
- }
- if (state == 6) {
- char otherChoice;
- cout << "You decided to explore the town! Unfortunately, there was a trap and you'd died! Would you like to try again? Y/N? \n"; //GAME OVER
- cin >> otherChoice;
- if (otherChoice == 'Y' || otherChoice == 'y') {
- state = 1;
- }
- else {
- state = 0;
- }
- }
- if (state == 7) {
- char fifthChoice;
- cout << "You decided to look for a working car! Sadly, it doesn't work... What would you do? \n A) Find Shelter or B) Hot Wire the Car \n";
- cin >> fifthChoice;
- if (fifthChoice == 'A' || fifthChoice == 'a') {
- state = 14; //Find Shelter
- }
- else if (fifthChoice == 'B' || fifthChoice == 'b') {
- state = 15; //Hot Wire the Car
- }
- }
- if (state == 8) {
- char sixthChoice;
- cout << "You've decided to to hunt for food and you encounter a Zombie! Would you like to: A) Aim for the head or B) Let it kill you? \n";
- cin >> sixthChoice;
- if (sixthChoice == 'A' || sixthChoice == 'a') {
- state = 10; //Aim for the head
- }
- else if (sixthChoice == 'B' || sixthChoice == 'b') {
- state = 11; //Let it kill you
- }
- }
- if (state == 9) {
- char otherChoice;
- cout << "You've decided to camp out! You encounter a werewolf! Would you like to: A) Kill it and make dinner out of it or B) Let it kill you? \n";
- cin >> otherChoice;
- if (otherChoice == 'A' || otherChoice == 'a') {
- state = 12; //Kill and make dinner
- }
- else if (otherChoice == 'B' || otherChoice == 'b') {
- state = 13; //Let it kill you
- }
- }
- if (state == 10) {
- char otherChoice;
- cout << "You decided to aim for the head! Unfortunately, the zombie killed you and you'd died! Would you like to try again? Y/N? \n"; //GAME OVER
- cin >> otherChoice;
- if (otherChoice == 'Y' || otherChoice == 'y') {
- state = 1;
- }
- else {
- state = 0;
- }
- }
- if (state == 11) {
- char otherChoice;
- cout << "You decided to let the zombie kill you! Unfortunately, you'd died! Would you like to try again? Y/N? \n"; //GAME OVER
- cin >> otherChoice;
- if (otherChoice == 'Y' || otherChoice == 'y') {
- state = 1;
- }
- else {
- state = 0;
- }
- }
- if (state == 12) {
- char otherChoice;
- cout << "You decided to kill the werewolf and made dinner. Unfortunately, You got sick and died in your sleep. Would you like to try again? Y/N? \n"; //GAME OVER
- cin >> otherChoice;
- if (otherChoice == 'Y' || otherChoice == 'y') {
- state = 1;
- }
- else {
- state = 0;
- }
- }
- if (state == 13) {
- char otherChoice;
- cout << "You decided to let the werefolf kill you! Unfortunately, you'd died! Would you like to try again? Y/N? \n"; //GAME OVER
- cin >> otherChoice;
- if (otherChoice == 'Y' || otherChoice == 'y') {
- state = 1;
- }
- else {
- state = 0;
- }
- }
- if (state == 14) {
- char otherChoice;
- cout << "You decided to look for shelter! You decided to sleep. Would you like to try again? Y/N? \n"; //GAME OVER
- cin >> otherChoice;
- if (otherChoice == 'Y' || otherChoice == 'y') {
- state = 1;
- }
- else {
- state = 0;
- }
- }
- if (state == 15) {
- char otherChoice;
- cout << "You decided to hot wire the car! Congratulations! You successful made it out the abandoned town! Would you like to play again? Y/N? \n"; //GAME OVER
- cin >> otherChoice;
- if (otherChoice == 'Y' || otherChoice == 'y') {
- state = 1;
- }
- else {
- state = 0;
- }
- }
- } while (state != 0);
- cout << state;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement