This repository was archived by the owner on Sep 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
74 lines (71 loc) · 1.84 KB
/
main.cpp
File metadata and controls
74 lines (71 loc) · 1.84 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
64
65
66
67
68
69
70
71
72
73
74
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include "project.h"
using namespace std;
void commandPrompt() {
int command_number;
Project *project = new Project();
cout << "Welcome to Project Database" << endl;
do {
string name;
string desc;
cout << "Press for a command." << endl;
cout << "1. List all Projects" << endl;
cout << "2. Find a Project" << endl;
cout << "3. Create a Project" << endl;
cout << "4. Update a Project" << endl;
cout << "5. Delete a Project" << endl;
cout << "6. Close the Program" << endl;
cout << ">> ";
cin >> command_number;
if(command_number > 6 && command_number < 1) {
cout << "Not a valid command" << endl;
cout << "" << endl;
}
if(command_number == 1) {
cout << "Listing Projects" << endl;
cout << "" << endl;
project->List();
cout << "" << endl;
}
if(command_number == 2) {
cout << "Find Project with Name: ";
cin >> name;
cout << "" << endl;
project->Find(name);
cout << "" << endl;
}
if(command_number == 3) {
cout << "Create Project" << endl;
cout << "" << endl;
cout << "Name and Description: ";
cin >> name;
getline(cin, desc);
project->Create(name, desc);
}
if(command_number == 4) {
cout << "Update Project" << endl;
cout << "Name and Description: ";
cin >> name;
getline(cin, desc);
project->Update(name, desc);
cout << "" << endl;
}
if(command_number == 5) {
cout << "Delete Project: " << endl;
cin >> name;
project->Destroy(name);
cout << "" << endl;
}
if(command_number == 6) {
cout << "Closing Program" << endl;
cout << "" << endl;
}
} while (command_number != 6);
}
int main(int argc, char* argv[])
{
commandPrompt();
}