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