40 lines
1.3 KiB
C++
40 lines
1.3 KiB
C++
#include <iostream>
|
|
#include <vector>
|
|
#include "userData.h"
|
|
#include "simpleMenu.h"
|
|
|
|
int main() {
|
|
std::vector<userData> data = getData();
|
|
std::vector<std::string> menuOptions = {"List the records in the file.", "Enter new records into the file.", "Change a particular record.", "Delete a particular record."};
|
|
while (true) {
|
|
int selection = simpleMenu(menuOptions, "What would you like to do?");
|
|
switch (selection) {
|
|
case 0:
|
|
std::cout << displayData(data);
|
|
std::cout << "Press Enter to Continue";
|
|
std::cin.ignore();
|
|
break;
|
|
case 1:
|
|
data.emplace_back(enterRecord());
|
|
std::cout << displayData(data);
|
|
updateData(data);
|
|
std::cout << "New data added.\nPress Enter to Continue";
|
|
std::cin.ignore();
|
|
break;
|
|
case 2:
|
|
changeEntry(data);
|
|
std::cout << "Data modified.\nPress Enter to Continue";
|
|
std::cin.ignore();
|
|
break;
|
|
case 3:
|
|
deleteEntry(data);
|
|
std::printf("Entry deleted.\n");
|
|
std::cout << "Press Enter to Continue";
|
|
std::cin.ignore();
|
|
break;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|