uhmm so yeah..
im a newbie in the c++ programming, here I have a test program that imitates how an atm works, but I keep having "illegal else without matching if" error even though I completed the if else structure... please tell me what is the current problem with this..
// Practical exam 2
#include <iostream>
using namespace std;
int main()
{
int n1, n2, n3, amount, deposit;
char choice, pin;
{
for(n1=1; n1<=3; n1++)
{
cout<<"Welcome to a random ATM program\n";
cout<<"\nPlease Enter your pin: ";
cin>>pin;
}
{
cout<<"Welcome to MCL-CIT bank!";
cout<<"\nPlease choose according to the action you wish to do:\n";
cout<<"\nPress [B] for Balance Inquiry";
cout<<"\nPress [W] for Withdrawal Transactions";
cout<<"\nPress [D] for Deposit Transactions";
cout<<"\nPress [X] to exit";
cin>>choice;
//balance
while (choice == 'B'|| choice == 'b')
{
cout<<"\nYour current Balace is PHP 1000";
cout<<"\nwould you like another transaction?";
cin>>choice;
}
//withdrawal
while (choice == 'W'|| choice == 'w')
{
cout<<"\nPlease enter the amount to be withdrawn: ";
cin>>amount;
{
if (amount % 100 == 0)
{ continue; }
cout<<"\nSorry the amount should be divisible by 100.";
cout<<"\nEnter the amount to be withdrawn: ";
cin>>amount;
else if (amount >1000)
{ continue; }
cout<<"\nSorry the amount should be within your current balance.";
cout<<"\nEnter the amount to be withdrawn: ";
cin>>amount;
else
cout<<"\nTransaction completed.";
}
cout<<"\nwould you like another transaction?";
cin>>choice;
}
cout<<"\nSorry this Machine only accepts bills of the lowest value of 20";
cout<<"\nPlease enter deposit amount: ";
cin>>deposit;
else
cout<<"\nTransaction completed.";
}
}
cout<<"\nWould you like another transaction?";
cin>>choice;
//exit
if(choice == 'X'|| choice == 'x')
cout<<"Thank you for Banking with us. Have a nice day :]";
}
cout<<"Thank you for Banking with us. Have a nice day :]";
}
return 0;
}