atm-admin/src/main.cpp

34 lines
1.1 KiB
C++

#include <iostream>
#include <cctype>
#include "AtmAdmin.h"
#include "XMLStorage.h"
char startup() {
char choice{};
std::cout << "1. Change PIN\n" << "2. Change account name\n" << "Q. Exit the program\n\n";
std::cout << ">: ";
std::cin >> choice;
return choice;
}
int main(int argc, [[maybe_unused]] char** argv) {
AtmAdmin::handleInvalidArguments(argc);
AtmAdmin::XMLStorage mainStorage{argv[1]};
bool continueLoop{true};
while (continueLoop) {
// startup() presents the user with the choices below.
// The other functions should handle invalid choices.
// ((1. Change pin || 2. Change money || 3. Change account name || Q. Exit the program))
char userChoice{startup()};
// The bulk of the program, allowing user to interact with the program.
// Always returns true unless 'Q' is entered.
continueLoop = AtmAdmin::handleUserInformation(static_cast<char>(std::tolower(userChoice)), mainStorage);
// std::cout << "PIN: " << mainStorage.pin << " || NAME: " << mainStorage.name << '\n'; // DEBUG
}
}