Code:
#include
using namespace std;
int sucpin, menu, loop;
float pin, balance, add;
char len;
int pins(){
int random;
int possiblepins[5] = {1234, 8645, 3675, 1432, 9348};
for(random = 0; random < 5; random++){
if(pin == possiblepins[random]){
sucpin = 1;
}
}
}
int main(){
loop = 1;
cout << "--\n-- Simple C++ Console ATM --\n--\n\n";
cout << ":>> ";
cin >> pin;
// couldnt figure out how to get the number of numbers entered so just skipped this step, if you figure it
// out then please let me know, thanks.
len = 4;
if(len == 4){
pins();
if(sucpin == 1){
while(loop < 5){
cout << "\n\n\t1) View Balance\n\t2) Withdraw\n\t3) Deposit\n\t4) Exit\n\n:>> ";
cin >> menu;
switch(menu){
case 1:
cout << "CURRENT BALANCE: GBP" << balance << endl << "AVAILIBLE: GBP" << balance;
break;
case 2:
cout << "No cash availible for withdrawal, Machine Out of Cash";
break;
case 3:
cout << "Deposit: ";
cin >> add;
balance = balance + add;
break;
case 4:
cout << "EXITING ACCOUNT, ERROR - ALL FUNDS STOLEN...";
loop = 6;
break;
}
}
}else{
cout << "ERROR, PIN NOT IN DATABASE";
}
}else{
cout << "ERROR, INVALID PIN LENGTH!";
}
return 0;
}
#include
using namespace std;
int sucpin, menu, loop;
float pin, balance, add;
char len;
int pins(){
int random;
int possiblepins[5] = {1234, 8645, 3675, 1432, 9348};
for(random = 0; random < 5; random++){
if(pin == possiblepins[random]){
sucpin = 1;
}
}
}
int main(){
loop = 1;
cout << "--\n-- Simple C++ Console ATM --\n--\n\n";
cout << ":>> ";
cin >> pin;
// couldnt figure out how to get the number of numbers entered so just skipped this step, if you figure it
// out then please let me know, thanks.
len = 4;
if(len == 4){
pins();
if(sucpin == 1){
while(loop < 5){
cout << "\n\n\t1) View Balance\n\t2) Withdraw\n\t3) Deposit\n\t4) Exit\n\n:>> ";
cin >> menu;
switch(menu){
case 1:
cout << "CURRENT BALANCE: GBP" << balance << endl << "AVAILIBLE: GBP" << balance;
break;
case 2:
cout << "No cash availible for withdrawal, Machine Out of Cash";
break;
case 3:
cout << "Deposit: ";
cin >> add;
balance = balance + add;
break;
case 4:
cout << "EXITING ACCOUNT, ERROR - ALL FUNDS STOLEN...";
loop = 6;
break;
}
}
}else{
cout << "ERROR, PIN NOT IN DATABASE";
}
}else{
cout << "ERROR, INVALID PIN LENGTH!";
}
return 0;
}
Do it works?? Where should i use that program? In atm machnes?
ReplyDeletejust try dude
ReplyDelete