1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
#include <iostream>
#include <conio.h>
#include <string>
#include <fstream>
using namespace std;
void Print(string text, ostream &out)
{
out << text;
}
int main()
{
string path = "C:\\SoftwareDev\\test.txt";
int NUM_MADLIB = 12;
string *madlib = new string[NUM_MADLIB]
{ "Enter Greeting: ", "Enter Action Verb ending in -ing: ", "Enter Tourist Site: ", "Enter Location: ",
"Enter Feeling Ending in -ly: ", "Enter Kind of Souvenir: ", "Enter Weekday: ", "Enter Number under 30: ",
"Enter Coworker Name: ", "Enter 4 digit Coworker Phone Number: ", "Enter Adjective: ", "Enter Your Name: " };
string letter[15] = {" I'm not here, virtually or physically. I'm off ", " at the ", " in ", ". ", " While I will ",
" send you warm thoughts and maybe even a souvenir ", ", ", " I will not reply to your email until ", " or day ",
" of next month, (whichever comes first). ", " /n If this is a life-threatening emergency, please call 911. But if you've gotten this far, you must be ok. In that case, call ",
" at ", ", with any immediate needs. ", " Have a/an ", " day! " };
for (int i = 0; i < NUM_MADLIB; i++)
{
cout << madlib[i] << " \n";
getline(cin, madlib[i]);
}
for (int i = 0; i < NUM_MADLIB; i++)
{
Print(letter[i], cout);
Print(madlib[i], cout);
if (i == 11)Print(letter[14], cout);
}
ofstream fout(path);
cout << "Would you like to print your story to a text file? (y/n) ";
char print;
cin >> print;
if (print == 'y' || print == 'Y') {
for (int i = 0; i < NUM_MADLIB; i++)
{
Print(letter[i], fout);
Print(madlib[i], fout);
if (i == 11)Print(letter[14], fout);
}
}
return 0;
}
|