#include <iostream> #include <string> #include <cstdlib> using namespace std; void drawBorder(); int main() { drawBorder(); std::cout << "Your name is " << std::endl; std::string name; std::cin >> name; std::cout << "Hello," << name << std::endl; std::cout << "what's your age?" << std::endl; int age; std::cin >> age; std::cout << "what's your gender? (m/f) " << std::endl; std::string gender; std::cin >> gender; if (gender == "m" || gender == "MALE") { std::cout << "Hi,gentleman" << std::endl; } else if (gender == "f" || gender == "FEMALE") { std::cout << "Hi,lady" << std::endl; } else { std::cout << " ERROR!!!" << std::endl; } std::cout << "please enter a positive number : " << std::endl; int x; std::cin >> x; std::cout << "please enter another positive number : " << std::endl; int y; std::cin >> y; int z = x*y; std::cout << "what the name of your magic : " << std::endl; std::string magic; std::cin >> magic; std::cout << "Enter the species of your wizard (human, orc, elf, dwarf): " << std::endl; int health = 30; string species; std::cin >> species; if (species == "orc") health = 50; else if (species == "elf") health = 20; std::cout << "Apprentice " << species << " wizard " << name << " hesitantly approached The Temple for the final test." << std::endl; std::cout << "As a " << age << " years-old young "; if (gender == "m") { std::cout << "gentleman"; } else if (gender == "f") { std::cout << "lady"; } else { std::cout << "intersex"; } std::cout << " had studied " << x << " spells for " << y << " hours each, toiling for a total of " << z << " hours." << std::endl; std::cout << name << " only hoped that the Maste would ask for the Apprentice's favorite incanatation," << std::endl; std::cout << "The simmoning of the " << magic << "..." << std::endl; //*/ int gold = rand() % 1001; std::cout << "Due to unprecented luck, you get to start with " << gold << " piece"; if (gold != 1 && gold != 0) std::cout << "s"; std::cout << " of gold. Your god Thor must look kindly upon you." << std::endl; cout << "Which direction do you want to travel (N, S, E, W)?" << endl; for (;;) { int attack = rand() % 10 + 1; string direction; std::cin >> direction; if (direction == "quit") { std::cout << "You abruptly ended your adventure, and teleported back to your homeland." << std::endl; break; } if (health <= 0) { std::cout << "You died!" << std::endl; break; } char dir = direction[0]; switch (dir) { case 'N': std::cout << "You are traveling north, where you bump into a troll." << std::endl; break; case 'S': { std::cout << "On your way traveling south, you fight a group of " << attack << " goblins." << std::endl; health -= 10; break; } case 'E': std::cout << "You are traveling east, where you bump into a troll." << std::endl; break; case 'W': { std::cout << "On your way traveling west, you fight a group of " << attack << " goblins." << std::endl; health -= 10; break; } default: std::cout << "Direction doesn't exist, please re-enter direction" << std::endl; break; } } } void drawBorder() { std::cout << "=\nWelcome to The Test\n\n=Please enter the following for a personalized story." << std::endl; }
Subscribe to:
Post Comments (Atom)
Post A Comment:
0 comments: