-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStoring the questions and answer 90% complete
59 lines (50 loc) · 1.15 KB
/
Storing the questions and answer 90% complete
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 <iomanip>
#include <fstream>
#include <sstream>
#include <iterator>
#include <string>
#include <vector>
#include <stdio.h>
using namespace std;
int main()
{
ofstream outputfile;
outputfile.open("Study.txt");
int num;
string ques, answ;
vector<vector<string> >flshcds;
cout << "How many questions would you like to store? \nYou can only store a maximum of 10 questions at once. ";
cin >> num;
while (num > 10)
{
cout << "You cannot enter more than 10 questions at once. \nPlease enter a number lower than 10! ";
cin >> num;
}
cin.ignore();
for (int i = 0; i < num; i++)
{
vector<string> question;
cout << "\nEnter the question: ";
getline(cin, ques);
for (int j = 0; j < 1; j++)
{
cout << "\nEnter the answer: ";
getline(cin, answ);
question.push_back(ques);
question.push_back(answ);
}
flshcds.push_back(question);
}
//cout << "";
for (int i = 0; i < flshcds.size(); ++i)
{
for (int j = 0; j < flshcds[i].size(); ++j)
{
cout << "\n" << flshcds[i][j] << "\n";
}
}
//copy(flshcds.begin(), flshcds.end(), ostream_iterator<string>(outputfile, "\n\n"));
outputfile.close();
return 0;
}