ASDV-Cpp/Assignments/MP4_CalebFontenot/main.cpp

40 lines
1.3 KiB
C++
Raw Normal View History

#include <iostream>
#include <vector>
#include "userData.h"
2024-04-12 21:59:01 -05:00
#include "simpleMenu.h"
int main() {
std::vector<userData> data = getData();
2024-04-12 21:59:01 -05:00
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;
}