atm 기계 만드는데 케이스2가 인출이란 말이야, 근데 현재 금액이 5만원이면
인출금을 2만원으로 했을때 잔액이 3만원 남아야하잖아 근데
실행하면 30032으로 떠
결론은 if안에 있는 data-=a <<이게 무슨 문제가 있는거 같은데 이걸 어떻게 해야할지 모르겠어
참고로 data가 현재 잔액이고 a는 인출변수야 ㅜㅜ
case 2:
printf("MY balance is : %d\n",data);
printf("How much do you want to Withdraw?: ");
scanf("%d",&a);
printf("You want to withdraw : %d", a);
printf(" Is that correct? (Y/N)");
scanf("%s",&s);
if(s=='Y', 'y')
{
if(data>a)
{
printf("Your current balance is: %d\n", data-=a (아마 이 부분이 잘못된게 아닌가 생각중....));
}
if(data<a)
{
printf("I am sorry, you have insufficient funds.\n ");
}break;
}
else if(s=='N','n')
break;
댓글 0