/* Carmens fourtne ... ToCarmenFromJared */ #include #include #include #include /* remember using */ using std::cout; using std::endl; using std::cin; // get fourtne function which returns a string and takes a unsigned integer as a parameter std::string getFourtne(unsigned int seed) { std::srand(seed);// seed the randomization based off the number they typed // switch a random number 1-10 switch(rand()%10) { case 0: return "You have the lucky number NULL"; case 1: return "The 1 will find u"; case 2: return "Jared is waiting"; case 3: return "Lift me back up to the sun"; case 4: return "I choose to live"; case 5: return "Life is like a box of chocalates"; case 6: return "Help me survive"; case 7: return "Help!"; case 8: return "She loves you yeah yeah yeah"; case 9: return "Private public, protected all the same 2 me"; } return ""; } // input a integer safely by first inputing a string then converting it to a integer int inInt() { char dat[1024];// character array cin >> dat;// input character array return atoi(dat);// convert to integer } // main function int main() { cout << "Enter your lucky number: ";//output to the screen int seed = inInt();// input a integer cout << "Your fourtne: " << getFourtne(seed) << endl;// print out the fourtne cout << "Would you like to try agian? y/n:";// prompt to try agian char c;// character variable named c cin >> c;// input c if(tolower(c) == 'y')// if statement with lowercased input is equal to 'y' main();// then recursivly call the main function (make it happen agian) return 0; }