+ 1
How to change PIN in Atm Transaction using C++
I badly need your help.
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;
+ 7
Give if condition according to your need like this
If(oldpin==1234)
Then
Enter new pin
And oldpin=newpin
+ 5
None of these are working. I already tried all of them😔😣
Someone help pleaseeee😭
+ 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.
+ 2
Hihihih. They already matched. But I dont know how to assign one of them to pin2 . AHAHHA Sorryyy😅
+ 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
+ 2
Thank youuu Jayakrishna😍
+ 1
Will this not working...?
if (newpin1==newpin2)
{
pin2=newpin1;
printf("Successful! Your PIN has been changed\n");
}
+ 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;
+ 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.
+ 1
Thank you guysss! I really do appreciate your help😭😘😘😘