-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
63 lines (59 loc) · 1.9 KB
/
main.cpp
File metadata and controls
63 lines (59 loc) · 1.9 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
58
59
60
61
62
63
//----------------------------------------------------
// Author: Rashi Ghosh
//----------------------------------------------------
#include <iostream>
#include <string>
#include "Database.h"
using namespace std;
//----------------------------------------------------
// Purpose: Find out what the user wants to do.
// Arguments: None.
// Returns: A number that indicates the users choice.
//----------------------------------------------------
int menuOptions()
{
int Choice;
do
{
cout << "\nEnter '1' to create a database\n"
<< " '2' to open an existing database\n"
<< " '3' to display a record\n"
<< " '4' to update a record\n"
<< " '5' to add a record\n"
<< " '6' to delete a record\n"
<< " '7' to create a report\n"
<< " '8' to close the database\n"
<< " '9' to quit the program\n"
<< "Selection: ";
cin >> Choice;
} while (Choice < 1 || Choice > 9);
return Choice;
}
int main()
{
cout << "Welcome to this database program! Please choose from the following: " << endl;
Database db;
//db.createDatabase();
int Choice;
Choice = menuOptions();
cout << "You picked " << Choice << endl;
while(Choice != 9)
{
switch (Choice)
{
case 1: db.createDatabase(); break;
case 2: db.openDatabase(); break;
case 3: db.displayRecord(); break;
case 4: db.updateRecord(); break;
case 5: db.addRecord(); break;
case 6: db.deleteRecord(); break;
case 7: db.createReport(); break;
case 8: db.closeDatabase(); break;
}
// Ask for next choice
Choice = menuOptions();
cout << "You picked " << Choice << endl;
}
db.closeDatabase();
return 0;
}