Repository navigation
Expand file tree
/
Copy pathMain.cpp
More file actions
67 lines (55 loc) · 2.26 KB
/
Copy pathMain.cpp
File metadata and controls
67 lines (55 loc) · 2.26 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
/**
* Carlos Castellanos
* June 21, 2026
* Core program execution loop managing user menus and input routing interfaces.
*/
#include <iostream>
#include <string>
#include "ItemTracker.h"
using namespace std;
int main() {
// Instantiate your system engine with the exact required rubric configuration paths
ItemTracker tracker("CS210_Project_Three_Input_File.txt", "frequency.dat");
int menuOption = 0;
string targetSearchWord;
// Primary application dashboard loop control flag monitoring
while (menuOption != 4) {
cout << "\n=========================================" << endl;
cout << " Corner Grocer Analytics " << endl;
cout << "=========================================" << endl;
cout << "1. Look Up Item Frequency" << endl;
cout << "2. Print Total Numerical Frequency List" << endl;
cout << "3. Print Character Histogram Visual" << endl;
cout << "4. Exit Application Console" << endl;
cout << "=========================================" << endl;
cout << "Enter selection selection preference (1-4): ";
// Catch string types if entered to shield the switch selector from getting trapped
if (!(cin >> menuOption)) {
cout << "Invalid format detected. Please select a numerical choice." << endl;
cin.clear();
cin.ignore(10000, '\n');
continue;
}
switch (menuOption) {
case 1:
cout << "Please specify the item name: ";
cin >> targetSearchWord;
cout << "\n>> Result matching '" << targetSearchWord << "': "
<< tracker.getItemFrequency(targetSearchWord) << " total item matches." << endl;
break;
case 2:
tracker.printAllFrequencies();
break;
case 3:
tracker.printHistogram();
break;
case 4:
cout << "Closing terminal operations context. Local system backup finalized successfully." << endl;
break;
default:
cout << "Value entry selection index bounds violation. Select an option from 1 to 4." << endl;
break;
}
}
return 0;
}