#include <iostream>
#include <string>
using namespace std;
int main()
{
int i = 5;
double balance = 0;
string username;
string password;
string enter_password;
string deposit;
string withdraw;
string dw_answer;
double d_answer;
double w_answer;
deposit = "How much do you wish to deposit? ";
withdraw = "How much do you wish to withdraw? ";
cout << "Enter your username: ";
cin >> username;
if (username == "Matteo") {
cout << "Username recognized." << endl << "Please enter password: ";
password = "boyinaband";
cin >> enter_password;
if (enter_password == password) {
cout << "You have logged in. Welcome back, Matteo." << endl;
cout << "Your current balance is " << balance << "." << endl;
while (i == 5) {
cout << "Would you like to deposit or withdraw? ";
cin >> dw_answer;
if (dw_answer == "deposit" || dw_answer == "Deposit") {
cout << deposit;
cin >> d_answer;
balance = balance + d_answer;
cout << "Your balance is now " << balance << "." << endl;
}
else if (dw_answer == "withdraw" || dw_answer == "Withdraw") {
try {
if (balance == 0) {
throw 99;
}
}
catch (int x) {
cout << "Error " << x << " - Cannot withdraw.";
}
}
else {
cout << withdraw;
cin >> w_answer;
balance = balance - w_answer;
}
}
}
}
}
}
return 0;
}
This code gives me the error of "Expected declaration before “}” token. Anybody knows why?