Team_Project/Team_Project/ATM.h

140 lines
3.1 KiB
C++

#pragma once
#include <iostream>
#include <windows.h>
#define HARDCODED_MAGIC_NUMBER 365
namespace ATM{
using std::endl,std::string;
using std::cout;
using std::cin;
int main()
{
int choice = 0;//Data validation pirmejam menu
do
{
cout << "\nMenu\n" << endl
<< "1 - Quit\n"
<< "2 - withdraw\n"
<< "3 - take a loan\n"
<< "4 - deposit\n"
<< "5 - account ballance\n"
<< "6 - MAINTENANCE\n"
<< "Enter your choice and press return: ";
std::cin >> choice;
switch(choice)
{
case 1://power off opcija
cout << "Farewell";
return 0;
case 2://naudas izsniegšanas kods
cout << "how much would you like to withdraw?\n";
int money;//kods kas nosaka vai nauda kontā ir pietiekami, lai izsniegtu
cout << " Enter the amount: ";
std::cin >> money;
if(money >= HARDCODED_MAGIC_NUMBER) {
cout << "You dont have the funds for this action\n";
break;
} else
{
cout << "Your cash has been delt\n";
}
break;
case 3://kods priekš lone funkcijas
int loan;
cout << "insert the amount that you would like to borrow: ";
std::cin >> loan;
if(loan >= 0) {
cout << "Thank you for choosing markuss bank for your loans...\nCounting your money\nSucces\n";
break;
} else
{//neļauj ievadīt negatīvus skaitļus
cout << "\nError\n";
}
break;
case 4:
cout << " insert your card\n";
int cardInfo;// attiecīgais int priekš noteiktās darbības
cout << " Enter the amount you would like to deposit: ";
std::cin >> cardInfo;
if(cardInfo >= 0)
{
cout << "Thank you for choosing markuss bank the only bank you need. The funds have been added to your account\n";
break;
} else
{//neļauj ievadīt negatīvus skaitļus
cout << "\nError\n";
}
break;
case 5://balance info
cout << "\nYou have 365$\n";
break;
case 6:
int MAINTENANCE();//kods kas ļauj pikļūt pie MAINTENANCE MODE
{
int msgboxID = MessageBox(
NULL,
(LPCWSTR)L"\nDo you want to enter MAINTENANCE MODE?",
(LPCWSTR)L"",
MB_ICONASTERISK | MB_YESNO | MB_DEFBUTTON2
);
switch(msgboxID)
{
case IDNO:
break;
case IDYES:
string username;
string password;
int otherchoice = 0;
cout << "Please input admin username : "; cin >> username;
cout << "Please input admins password : "; cin >> password;
if(username == "Markuss") {
if(password == "123") {
cout << "you are online admin\n" //ievadot pareizos datus atveras jauns menu
<< "\nAdmins Menu\n\n"
<< "1 - System requirement info\n"
<< "2 - Turn of the device\n"
<< "Enter your choice and press return: ";
std::cin >> otherchoice;
switch(otherchoice)
{
case 1:
cout << "\n*standard atm stuff*\n";
break;
case 2:
return 0;
}
} else
{
cout << "Invalid password! " << endl;
}
} else
{
cout << "Invalid username! " << endl;
}
break;
}
break;
}
break;
}
}
while(choice != 1);
}
}