Refactored confirmUserInformation
, updated startup()
logic, and changed README plans.
This commit is contained in:
parent
cbc3bb557d
commit
022ea7d79d
|
@ -5,7 +5,7 @@ An administrative software for use alongside the ATM program at https://www.drag
|
|||
## Plan
|
||||
|
||||
This program will allow for the creation of new users, deletion of users, editing of money, changing of pin.
|
||||
(For the start, simply allow changing the pin & money.)
|
||||
(For the start, simply allow changing the pin & name.)
|
||||
This program will be terminal-only.
|
||||
|
||||
## Current plans
|
||||
|
|
|
@ -7,26 +7,18 @@
|
|||
#include "Errorseal.h"
|
||||
|
||||
namespace AtmAdmin {
|
||||
// Used to make certain functions more concise.
|
||||
// Used to make certain functions more concise and easier to read.
|
||||
enum Choice {
|
||||
PIN,
|
||||
NAME,
|
||||
MONEY,
|
||||
};
|
||||
|
||||
char startup() {
|
||||
char choice{};
|
||||
std::cout << "1. Change PIN\n" << "2. Change account name\n" << "3. Change money\n" << "Q. Exit the program\n\n";
|
||||
std::cout << ">: ";
|
||||
|
||||
std::cin >> choice;
|
||||
|
||||
return choice;
|
||||
}
|
||||
|
||||
void confirmUserInformation (std::string& information, const std::string& tempInformation, enum Choice choice) {
|
||||
// Allows the user to double-check their inputted information.
|
||||
// It also saves and applies the information if the user accepts it.
|
||||
void confirmUserInformation (std::string& information, const std::string& tempInformation, const Choice choice) {
|
||||
char userCheck;
|
||||
bool loopDone = true;
|
||||
[[maybe_unused]] bool loopDone = true;
|
||||
|
||||
do {
|
||||
if (choice == PIN)
|
||||
|
@ -68,7 +60,6 @@ namespace AtmAdmin {
|
|||
// This is handled by the if statement.
|
||||
tempInformation = changeAccountPin();
|
||||
if (tempInformation != "invalid") {
|
||||
// Checks with the user if the name is okay, if so, it applies it.
|
||||
confirmUserInformation(information, tempInformation, PIN);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,15 @@
|
|||
#include <cctype>
|
||||
#include "AtmAdmin.h"
|
||||
|
||||
char startup() {
|
||||
char choice{};
|
||||
std::cout << "1. Change PIN\n" << "2. Change account name\n" << "3. Change money (UNFINISHED)\n" << "Q. Exit the program\n\n";
|
||||
std::cout << ">: ";
|
||||
|
||||
std::cin >> choice;
|
||||
|
||||
return choice;
|
||||
}
|
||||
|
||||
int main() {
|
||||
bool continueLoop{true};
|
||||
|
|
Loading…
Reference in New Issue
Block a user