Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main(int argc, char **argv)
- {
- string name, kingdom, place, favItem, sex;
- bool sxfull = false;
- string heshe, himher, hisher;
- int len = 0;
- // Assignment 1 Test 1 - Short Story
- /* Append == customized short story */
- cout << "This is a customized story for the user.\n "
- << "Please maximize the window before entering data to make it more readable.\n"
- << "***Please keep entries less than 20 characters.***\n";
- cout << "Enter your name: ";
- getline(cin, name, '\n');
- len = name.length();
- while(len > 20)
- {
- cout << "Too long, less than 20 characters!\nEnter your name:";
- getline(cin, name, '\n');
- len = name.length();
- }
- while(!sxfull)
- {
- cout << "Enter the sex (M/F): ";
- getline(cin, sex, '\n');
- if(sex == "m")
- break;
- else if(sex == "M")
- break;
- else if(sex == "f")
- break;
- else if(sex == "F")
- break;
- else
- cout << "You MUST enter M or F for sex!\n";
- }
- cout << "Enter a name for the kingdom: ";
- getline(cin, kingdom, '\n');
- len = kingdom.length();
- while(len > 20)
- {
- cout << "Too long, less than 20 characters!\nEnter a name for the kingdom: ";
- getline(cin, kingdom, '\n');
- len = kingdom.length();
- }
- cout << "Enter your favorite place: ";
- getline(cin, place, '\n');
- len = place.length();
- while(len > 20)
- {
- cout << "Too long, less then 20 characters!\nEnter your favorite place: ";
- getline(cin, place, '\n');
- len = place.length();
- }
- cout << "Enter you favorite item: ";
- getline(cin, favItem);
- len = favItem.length();
- while(len > 20)
- {
- cout << "Too long, less than 20 characters!\nEnter your favorite item: ";
- getline(cin, favItem);
- len = favItem.length();
- }
- if (sex == "M" || sex == "m")
- {
- heshe = "he";
- himher = "him";
- hisher = "his";
- }
- else
- {
- heshe = "she";
- himher = "her";
- hisher = "her";
- }
- cout << "\n\n\n\n"
- << "\t\t========================================\n"
- << "\t\t========================================\n"
- << "\t\t======== The Great Misadventure ========\n"
- << "\t\t========================================\n"
- << "\t\t========================================\n\n"
- // pagraph 1 - intro
- << "\tThis is the tale of " << name << " and the magical " << favItem << ". In the kingdom of\n"
- << kingdom << ", in the corner of a " << place << ", sat the ever quiet " << name << " contemplating how to\n"
- << "become rich and famous. " << name << " just knew " << heshe << " had greatness locked deep down inside\n"
- << "of " << himher << ", but didn't know how to unlock all that potential. The kingdom has been attacked by\n"
- << "a troll who loved to eat " << favItem << " all day long.\n\n"
- // paragraph 2
- << "\tThat is how " << name << " would become famous, by defeating the evil troll. The kingdom would recognize " << himher << "\n"
- << "as the great hero " << heshe << " had always dreamed about. " << name << " asked around about the troll when he found out\n"
- << "about " << kingdom << "'s witch who could take a regular " << favItem << " and turn it magical in order to beat the troll.\n"
- << name << " climbed down the long, moldy stars that lead to the dimly lit room of the dark, dank dungeon where the witch resided.\n"
- << "Upon entering her chamber, " << name << " felt a sense of fear rush over " << himher << " as the witch was in a huge stone throne\n"
- << "with the back towards " << name <<". Thoughts of what the witch would look like ran through " << hisher << " head. Suddenly the witch\n"
- << "stood up and started to turn. Trembling, " << name << " stepped forward. The witch turned to face him, revealing she wasn't ugly\n"
- << "like " << name << " had originally thought. In fact, she was stunning, but why would she live in a dungeon? " << name << " was\n"
- << "utterly confused. The witch had been expecting " << name << " and already had the " << favItem << " magically enchanted and ready\n"
- << "for " << himher << ". Now it was time for " << himher << " to set out to find the troll that has been attacking " << kingdom << "\n"
- << "and beat it once and for all.\n\n"
- // paragraph 3
- << name << " went into the jungle outside the kingdom toward the old covered bridge where the troll was known to live. Every knight sent\n"
- << "to beat the troll had never returned. " << name << " knew the danger, but " << hisher << " drive for fame was stronger than the fear\n"
- << "of the quest to vanquish the troll. When " << heshe << " entered the cavern under the bridge, " << name << " couldn't believe what " << heshe << "\n"
- << "saw, the troll sitting there crying because all the " << favItem << " had been eaten and the troll had no more left. Turns out the trolls attacks\n"
- << "weren't attacks, but rather just food searches. " << name << " gave the troll the enchanted " << favItem << " while " << name << " watched\n"
- << "the troll eat it and to his surprise another one appear in front of the troll. The enchantment was to make a new one appear, thus ending the\n"
- << "attacks on the village and making " << name << " a true hero...to the troll at least.\n\n"
- << "\t\t\tT D\n"
- << "\t\t\t H N\n"
- << "\t\t\t E E\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment