forked from DiscoWare/sentenceGenerator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
57 lines (52 loc) · 1.14 KB
/
main.cpp
File metadata and controls
57 lines (52 loc) · 1.14 KB
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
#include "stdafx.h"
#include "Dictionary.h"
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
using namespace std;
/*
Author: Steven Steele
Date: February 19, 2018
Assignment: Lab_02
*/
int main()
{
Dictionary example("nounlist.txt", "verblist.txt",
"adverblist.txt", "adjectivelist.txt", "prepositionlist.txt", "articlelist.txt");
bool done = false;
cout << " Sentence Generator\n"
<< "---------------------------------------\n"
<< "This program generates random sentences\n\n";
while (!done)
{
cout << "Choose an option:\n" << "1. Generate Random Sentence";
cout << "\n2. Quit\n";
int input;
cin >> input;
if (!cin)
{
cout << "\nINVALID INPUT. Please enter '1' or '2'.\n\n";
cin.clear();
cin.ignore(100, '\n');
}
else
{
if (input == 1)
{
cout << "\n" << example.generateSentence() << "\n\n";
}
else if (input == 2)
{
done = true;
}
else
{
cout << "\nYour input could not be understood. Please enter '1' or '2'.\n\n";
}
}
}
cout << "\nThanks for playing!\n";
system("Pause");
return 0;
}