-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
61 lines (55 loc) · 1.35 KB
/
main.cpp
File metadata and controls
61 lines (55 loc) · 1.35 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
/*Purpose of this program is to have the user input numbers that will then be pushed into a vector. Then the user will have the option to search the vector or sort the vector. If they choose to sort they can pick from
bubble, selection, and insertion sorts. If they choose to search then they will pick from binary and linear search. Then the program outputs to the user.*/
#include "IntSequence.h"
#include <iostream>
#include<vector>
#include <sstream>
#include <string>
using namespace std;
void main_menu()
{
cout << "1. Read" << endl;
cout << "2. Print" << endl;
cout << "3. Sort" << endl;
cout << "4. Search" << endl;
cout << "5. Quit" << endl;
}
int main()
{
//initialize object pointer
IntSequence *intSeq = NULL;
//initialize user input
int mainChoice = 0;
//while statement to run while they dont exit
while (mainChoice != 5)
{
//get user choice
main_menu();
cin >> mainChoice;
//switch statement to go to different parts of the menu
switch (mainChoice)
{
case 1:
delete intSeq;
intSeq = new IntSequence();
intSeq->_read();
break;
case 2:
cout << "Sequence: ";
intSeq->_print();
break;
case 3:
intSeq->_sort();
break;
case 4:
intSeq->_search();
break;
case 5:
cout << "Than you for using this program,bye." << endl;
break;
default:
cout << "Invalid option!" << endl;
}
}
return 0;
}