my if else statement has an error it said that there is no if before else in my loop
here is my code:
Code:
#include <stdio.h>
#include <conio.h>
int main()
{
int choice, deposit_amount, withdraw_amount, pin, x, i, trial=0;
float initial_amount = 20000, current_amount;
char width, trans;
printf("#######################################################################################################################");
printf("\n# #");
printf("\n# WELCOME TO LANDBANK #");
printf("\n# ATM 24 - HOUR SERVICES VISA|BANCHET|PAYMAYA #");
printf("\n#######################################################################################################################");
while (pin != 012345)
{
for(x=1; x<=3; x++)
{
printf("\n");
printf("%45c ENTER YOUR SECRET PIN NUMBER: ", width);
scanf("%d", &pin);
if (pin == 012345);
{
besugo:
printf("\n\n%37c*************Welcome to ATM Service*************", width);
printf("\n%49c 1. Balance Inquiry ", width);
printf("\n%50c 2. Withdraw Cash ", width);
printf("\n%50c 3. Deposit Cash ", width);
printf("\n%50c 4. Quit ", width);
printf("\n%37c************************************************", width);
printf("\n\n%45c Enter your choice: ", width);
scanf("%d", &choice);
switch(choice)
{
case 1:
printf("%45c YOUR BALANCE IS: %.0f", width ,initial_amount);
whodoes:
printf("\n%45c Do you wish to have another transaction?(Y/N): ",width);
scanf("%c", &trans);
scanf("%c", &trans);
switch (trans)
{
case 'Y':
goto besugo;
break;
case 'N':
printf("\n\n%45c THANK YOU FOR USING ATM SERVICE!", width);
break;
}
{
break;
}
case 2:
printf("%45c ENTER AMOUNT TO WITHDRAW: ",width);
scanf("%d", &withdraw_amount);
current_amount = initial_amount - withdraw_amount;
if (withdraw_amount>10000)
{
printf("\n%45c You can only withdraw maximum amount of 10,000.00", width);
goto whodoes;
}
else
{
printf("\n%45c PLEASE COLLECT CASH.......", width);
printf("\n%45c YOUR CURRENT BALANCE IS %.0f", width, current_amount);
goto whodoes;
break;
}
{
break;
}
case 3:
printf("%45c ENTER THE AMOUNT TO DEPOSIT: ", width);
scanf("%d", &deposit_amount);
current_amount = initial_amount + deposit_amount;
printf("%45c YOUR CURRENT BALANCE IS %.0f", width, current_amount);
goto whodoes;
break;
{
break;
}
case 4:
printf("\n\n%45c THANK YOU FOR USING ATM SERVICE!", width);
break;
default:
printf("\n\n%45cINVALID TRANSACTION!", width);
break;
{
break;
}
}
}
else
printf("PLEASE ENTER A CORRECT PIN NUMBER")
scanf("%d", &trial);
printf("%d trial left", trial++);
if(trial == 3)
{
printf("ACCOUNT IS TEMPORARILY BANNED");
break;
}
}
}
getch();
return 0;
}