illegal else without matching if problem...

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;
}
{

if(pin == 'XXX' || pin == 'xxx' || choice == 'Y'|| choice == 'y')

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;
}

//deposit
while (choice == 'D'|| choice == 'd')
{
cout<<"\nThis machine accept bills only.";
cout<<"\nEnter Deposit amount: ";
cin>>deposit;
{
if(deposit % 20 == 0)
{ continue; }

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;
}
You don't have brackets around if code... also in your for statement it says
n1<=3 all you need is n1<3
Around line #20 it says
1
2
3
4
5
6
7
{
}
If (pin=='XXX'..;)

/*
Code
*/

You need
[code]
if (pin=='XXX'...)
{
/*
Code
*/
}
Ok,

Please read this:

http://www.cplusplus.com/doc/tutorial/control/

and this:

http://www.cplusplus.com/search.do?q=code+tags

To people who would give a link to a code tags thread, this is more persuasive. ;-)
Topic archived. No new replies allowed.