Please help me to solve this ATM Project .(C++ )

HI ;)
I AM NEW in c++ programming;
and i had a ATM Project ;
but i dont know what i do :{

Your are about to simulate a simp ple automated teller machine (ATM). It shoul ld do five basic tasks:

1.
Withdrawing from user’s balance. This operation can be executed as t the balance allows to do
so.
2.
Depositing to user’s acco ount.
3.
User’s balance inquiry.
4.
Inquire about the last 5 tr ransactions that have been done through a ses ssion starting from the
last one (whether they ar re withdraw or deposit or just inquiry).
5.
Editing personal informattion that includes: Telephone Number, email aaddress and password.
1

Password should be encry ypted after changing it using Caesar cipher wwith a shift of 3.

Password should be decry ypted before comparing it to the one that user r entered.

These tasks can be executed uupon user choice as the user does not choose e to quit. For security, this
list of tasks will not be show wn as the password is wrong. So, first of all l the user is prompted for
his/her password to show th he list of operations. The user have only th hree attempts to enter the
correct password. As the th hird attempt is wrong, the program should terminate and no task is
presented.

Remarks:


Assume an initial balanc ce of the account is 5000 and the ATM passwo ord is a12b.

Your program should be menu-driven in which it should display a me enu with the options
shown above in addition n to quit option.

As the user choose to ed dit his/her personal information, your program m also has to display
another
menu
with four options: changing Telephone Number, changiing Email address,
changing password, and back to the main menu.

There is two algorithms for Caesar Cipher presented in Appendix A, yyou can use them or use
your own algorithm to im mplement the cipher.
Caesar Algorithm m is presented in Appendix A. 1


Appendix A

Caesar Algorithm

The Caesar cipher is one of the eearliest known and simplest ciphers. It is a tyype of substitution cipher
in which each letter in the plain ntext is 'shifted' a certain number of places down the alphabet. For
example to cipher letter A with a shift of 2, it will be C and B will be D , YY will be A , Z will be B
and so on. Another Example, Ass suming we have letter set

0 1 2 ………………24 25

A B C … …… … … … Y Z

If the shift is 3 and the plain text t is MYPASSWORD
Then the encrypted text using Caaesar cipher is: PBSDVVZRUG

Algorithms:
Encrypt (PlainText,shift)
Loop over PlainText
NextCharacter = GetNext(PlainText)
EncryptedCharacter = ( (ASCII of NextCharacter - ASCII of first charactar in
character's list + shift) MOD size of character's list) + ASCII of first charachtar in character's list
Append EncryptedCharacter to EncryptedString
End Loop
End Encrypt


}
I need you to understand this project and writing code, help me please,,
from my opinion, for creating account, you can use <vector>. and the caesar encryption is just shifting the character using arithmetic operations and little algorithm... btw, what's wrong with your writing?
my code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#include<iostream>
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string>
using namespace std;

void sat();
void menu();
void balance();
void deposit();
void withdraw();
void Editing ();
int password;
double bal=5000;
main()
{
    
   
    cout<<"*****WELCOME TO BANK ATM !*****"<<endl;
int  no;
cout<<"***** If you are a new user press No. 9, or 0 if not!*****"<<endl;
cin>>no;
if (no==9)
Editing ();

cout<<"enter password:\n";
    int password;
for (int i=0;i<3;i++)
{
	cout<<"enter password:\n";
	cin>>password;
	if (password==12345)
    menu();
    else
    gotoxy();
    cout<<"Invalid. . .";
getch();
return 0;
}

void menu()
{
    int m;
    clrscr();
    cout<<"**********MENU**********"<<endl<<endl;
    cout<<"Choose a menu from the list"<<endl;
cout<<"1. Deposit Cash"<<endl;
cout<<"2. Cash Withdrawal"<<endl;
    cout<<"3. Balance Inquiry"<<endl;
    cout<<"4. Editing personal information"<<endl ;
    cout<<"Enter menu: ";
    cin>>m;

switch (m)
{
	case 1:
			deposite();               /*to deposite money*/

			break;

	case 2:
			withdraw();              /*to withdraw money*/

			break;
	case 3:	                                 /*to see the balance*/
	    balance();
	break;
case 4:	                                 /*to see the balance*/
	Editing ();
	break;


	default:                              /*if choice is not valid*/

	cout<<"ERROR// PLEASE TRY AGAIN";
	exit(1);
}
getch();

void sat()
{
    char ans;
    cout<<"Do you wish to make another transaction(y/n)?"<<endl;
    cin>>ans;

    if(ans=='y')
    menu();
    else if(ans=='n')
    cout<<”thanx”;
    else
getch();
return;
}
void balance()
{
    clrscr();
    char ans;
    cout<<"**********BALANCE**********"<<endl<<endl;
    cout<<"Your current balance is: "<<bal<<endl;
sat();
getch();
return;
}



void deposit()
{

    clrscr();
    int dep;
    char ans;
    cout<<"**********DEPOSIT CASH**********"<<endl<<endl;
    cout<<"Enter amount: "<<endl;
    cin>>dep;
    bal=bal+dep;
    cout<<"Successful!"<<endl;
sat();
getch();
return;
}





void withdraw()
{
    clrscr();
    int with;
    char ans;
    cout<<"**********CASH WITHDRAWAL**********"<<endl<<endl;
    cout<<"Enter amount: "<<endl;
    cin>>with;
    bal=bal-with;
    cout<<"SUCCESSFUL!"<<endl;
    cout<<"Your current balance is: "<<bal<<endl;
sat();
getch();
return;
}

void Editing () {
clrscr();
string Telephone Number, email aaddress; 
int password;

cout<<"enter Telephone Number : ";
cin>> Telephone Number;

cout<<"enter email aaddress: ";
cin>> email aaddress;

int pass;
cout<<"enter password: ";
cin>> password;
cout<<"enter password agene: ";
cin>>pass;

while (pass!= password){
cout <<" not corresponding";
cout<<"enter password: ";
cin>> password;
cout<<"enter password agene: ";
cin>>pass;
}
cout <<" not corresponding";


sat();

getch();
return;
}




I think it contains logical errors and compilation errors :(

closed account (18hRX9L8)
My Code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/* Usandfriend's ATM Code */
#include <stdio.h>
#include <strlib.h>
#include "simpio.h"
#include "genlib.h"

main()
{
       int what_user_wants,dep,wit,exit;
       float totaldeposit,totalwithdrawal,balance;
       string password,name,phonenumber,address,accountnumber,newname,newphonenumber,newaddress,newpassword;
       
       totaldeposit=0;
       totalwithdrawal=0;
       dep=0;
       wit=0;
       balance=5000;
       password="21b";
       name="John Bloke";
       phonenumber="1-234-567-8910";
       address="Street, City, State, Zip Code, United States";
       accountnumber="32a10dhd3h";
       
       printf ("***************************************ATM*************************************\n\n");
       PASSWORD:
       printf ("Enter Password.\n\n  > ");
       newpassword=GetLine();
       printf ("\n");
       if (StringEqual(newpassword,password)==TRUE)
       {
               printf ("Unlocked.\n\n\n");
               goto begin;
       }
       else {
               printf ("Retry.\n\n");
               goto PASSWORD;
            }
       begin:
       printf ("Enter the option number you need.\n");
       printf ("1. Withdraw from Balance.\n");
       printf ("2. Deposit.\n");
       printf ("3. Balance Inquiry.\n");
       printf ("4. Last 5 Transactions.\n");
       printf ("5. Edit Personal Information.\n");
       printf ("6. Exit.\n\n  > ");
       what_user_wants=GetInteger();
       
       switch (what_user_wants)
       {
              case 1: goto WithdrawBalance;break;
              case 2: goto DepositBalance;break;
              case 3: goto BalanceInquiry;break;
              case 4: goto PrintLast5Inquiry;break;
              case 5: goto EditInformation;break;
              case 6: goto Exit;break;
              default: printf ("Please retry.\n\n");goto begin;break;
       }

       WithdrawBalance:
       
       double withdraw;
       
       wit++;
       printf ("How much money would you like to withdraw?  ");
       withdraw=GetReal();
       totalwithdrawal=withdraw+totalwithdrawal;
       balance=balance-withdraw;
       printf ("New balance is %.2f.\n\n",balance);
       
       goto begin;
       
       DepositBalance:
                      
       double deposit;
                  
       dep++;
       printf ("How much money would you like to deposit?  ");
       deposit=GetReal();
       totaldeposit=totaldeposit+deposit;
       balance=balance+deposit;
       printf ("New balance is %.2f.\n\n",balance);
       
       goto begin;
       
       BalanceInquiry:
                      
       printf ("Total balance: %.2f.\n\n",balance);
       
       goto begin;
       
       PrintLast5Inquiry:
                         
       printf ("Total withdrawals: %.2f.\n",totalwithdrawal);
       printf ("Total deposits: %.2f.\n\n",totaldeposit);
       
       goto begin;
       
       EditInformation:
                       
       printf ("Your current information is:\n");
       printf ("  Name:  %s\n",name);
       printf ("  Phone Number:  %s\n",phonenumber);
       printf ("  Address:  %s\n",address);
       printf ("  Account Number:  %s\n\n",accountnumber);
       begin123:
       printf ("Enter choice number.\n");
       printf ("1. Change Information.\n");
       printf ("2. Continue.\n\n  > ");
       what_user_wants=GetInteger();
       
       switch (what_user_wants)
       {
              case 1: goto ChangeInformation;break;
              case 2: goto begin;break;
              default: printf ("Please retry.\n");goto begin123;break;
       }
       
       goto begin;
       
       ChangeInformation:
                         
       printf ("Enter new name or enter \"NULL\" to keep same name.\n\n  > ");
       newname=GetLine();
       printf ("\n");
       
       if (StringEqual(newname,"NULL")==TRUE)
       {
               name=name;
       }
       else {
               name=newname;
            }
       
       printf ("Enter new phone number or enter \"NULL\" to keep same number.\n\n  > ");
       newphonenumber=GetLine();
       printf ("\n");
       
       if (StringEqual(newphonenumber,"NULL")==TRUE)
       {
               phonenumber=phonenumber;
       }
       else {
               phonenumber=newphonenumber;
            }
       
       printf ("Enter new address or enter \"NULL\" to keep the same address.\n\n  > ");
       newaddress=GetLine();
       printf ("\n");
       
       if (StringEqual(newaddress,"NULL")==TRUE)
       {
               address=address;
       }
       else {
               address=newaddress;
            }
       
       goto begin;
       
       Exit:
       
       printf ("Are you sure you want to exit? Enter 1 to exit or 2 to stay.\n");
       exit=GetInteger();
       
       switch (exit)
       {
              case 1: goto hi;break;
              case 2: goto begin;break;
              default: printf ("Please retry.\n");goto Exit;break;
       }
       hi:;
}


No errors but I don't know how to do the password properly and the Last 5 Inquiry.
I too am a new C++ programmer, so yeah...

EDIT: DO NOT USE THIS CODE, IT HAS GOTOs WHICH ARE SECURITY PROBLEMS.
Last edited on
Topic archived. No new replies allowed.