How to change PIN in Atm Transaction using C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to change PIN in Atm Transaction using C++

I badly need your help.

28th Apr 2020, 1:17 AM
Dimwit
Dimwit - avatar
12 Answers
+ 1
case 4: printf("How much would you like to withdraw? Please select an amount.\n"); option: printf("(1)200\n"); printf("(2)500\n"); printf("(3)1000\n"); printf("(4)5000\n"); printf("(5)10000\n"); scanf("%c", &b); //here you shloud take option, according to printf conditions.. if(b=='1') { balance=balance-200; printf("You have withdrawn 200: bal=%d", balance); //here, use %d to print a integer value which given argument, as amount, you mean balance here.. So I changed.. } else if(b=='2') { balance=balance-500; printf("You have withdrawn 500: bal=%d", balance); } else if(b=='3'&& balance>=1000) { balance=balance-1000; printf("You have withdrawn 1000, bal=%d", balance); } else if(b=='4'&& balance>=5000) { balance=balance-5000; printf("You have withdrawn 5000, bal=%d", balance); } else { printf("Enter proper amount\n "); goto option; } goto menu; break;
29th Apr 2020, 10:21 PM
Jayakrishna ๐Ÿ‡ฎ๐Ÿ‡ณ
+ 7
Give if condition according to your need like this If(oldpin==1234) Then Enter new pin And oldpin=newpin
28th Apr 2020, 11:59 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 5
None of these are working. I already tried all of them๐Ÿ˜”๐Ÿ˜ฃ Someone help pleaseeee๐Ÿ˜ญ
29th Apr 2020, 12:06 AM
Dimwit
Dimwit - avatar
+ 2
Post the code you have written so far and indicate where you are having trouble. We will help you once we have a code sample we can review.
28th Apr 2020, 3:20 AM
Elizabeth Kelly
Elizabeth Kelly - avatar
+ 2
Hihihih. They already matched. But I dont know how to assign one of them to pin2 . AHAHHA Sorryyy๐Ÿ˜…
28th Apr 2020, 5:16 AM
Dimwit
Dimwit - avatar
+ 2
Whaaaa sorry again. But I really don't know what's wrong with my FAST CASH I don't know how to make it work. Can someone help me with this? Please check my code. Thank you so muchhh ๐Ÿ˜ญ https://code.sololearn.com/cbkq8UWm0977/?ref=app
29th Apr 2020, 9:49 PM
Dimwit
Dimwit - avatar
+ 2
Thank youuu Jayakrishna๐Ÿ˜
29th Apr 2020, 11:23 PM
Dimwit
Dimwit - avatar
+ 1
Will this not working...? if (newpin1==newpin2) { pin2=newpin1; printf("Successful! Your PIN has been changed\n"); }
28th Apr 2020, 11:02 AM
Jayakrishna ๐Ÿ‡ฎ๐Ÿ‡ณ
+ 1
Dimwit Here, newpin1, newpin2 you declared as char and taking input with %s string but need is a intiger. So I changed as needed and it works... [And also specify where are executing this.., this is C code you are running on c++, it works but so other some changes need depending on compiler..] case 5: int newpin1, newpin2; //change it at initialization.. printf("Change PIN\n"); printf("Please enter your new PIN\n"); scanf("%d",&newpin1); printf("Please re-enter your new PIN\n"); scanf("%d",&newpin2); //ch=getch(); if (newpin1==newpin2) { pin2=newpin1; printf("Successful! Your PIN has been changed\n"); } else { printf("Incorrect PIN\n"); } goto start; break;
29th Apr 2020, 7:28 AM
Jayakrishna ๐Ÿ‡ฎ๐Ÿ‡ณ
+ 1
Hello Dimwit this is Nikhil .I am posting code for Ur help please check that . Firstly, Your code contains printf() and scanf() and you wrote code in C++ how can that work? Secondly, You can't use conio.h in sololearn so I replaced getch with getchar(). Thirdly, plz avoid lables and goto's in a program .It is bad way of writing program it may crash Ur program , It might be helpful in some emergency cases . https://code.sololearn.com/cL9UoPtT2ZwT/?ref=app Thank you I hope this might help u.
29th Apr 2020, 7:42 AM
Nikhil Maroju
Nikhil Maroju - avatar
+ 1
Thank you guysss! I really do appreciate your help๐Ÿ˜ญ๐Ÿ˜˜๐Ÿ˜˜๐Ÿ˜˜
29th Apr 2020, 9:35 PM
Dimwit
Dimwit - avatar