ERROR BRACE

i have a missing left brace but i cannot find ..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
  #include <conio.h>
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

class User 
{

public:
 string username;
 string password;

 void userRegister()
 {
  cout << "\n---------Registration Screen--------" << endl;
  cout << "Enter Username: ";
  cin >> username;
  cout << "Enter Password: ";
  cin >> password;
  fstream usersFile;
  usersFile.open("userID.txt", fstream::app);

  if ( !usersFile.is_open())
  {
   cout << "Unable to open file!" << endl;
  }
  else 
  {

   usersFile << username << " " << password << endl;
  }
   usersFile.close();
};
 
int main()
{
 int choice;
 cout << "Welcome to THE GAME OF LIFE!!!11" << endl;
 cout << "1. Register" << endl;
 cout << "2. Login" << endl;
 cout << "Your choice is: ";
 cin >> choice;
 if (choice == 1)
 { 
 User person;
 person.userRegister();
 }  
 

 else if (choice == 2)
{
 string userID, password;
 string pwdId, pwd;
 bool found = false;
 int i = 0;
 cout << "\n----------------Login Screen--------------------" << endl;
 }
 while (i(heart) && !found)
 {
  cout << "Please enter your userID:\t";
  cin >> userID;
  cout << "Please enter your password:\t";
  cin >> password;

  ifstream inFile;
  inFile.open("userID.txt");
  found = false;
  if (!inFile)
   cout << "Unable to open file" << endl;
  else
  {
   while (!inFile.eof() && !found)
   {
    inFile >> pwdId >> pwd; 
    if (userID.compare(pwdId) == 0 &&
     password.compare(pwd) == 0)
    {
     found = true;
     cout << "Welcome! \n";
    }
   
  
  if (!found)
  {
   i++;
   cout << "You have entered the wrong info!" << endl;
  }
  else
  {
   cout << "You have successfully logged into the system!" << endl;

  }
  
 }
 if (i==3)
  cout << "\nYou have reached maximum number of trials. Access Denied!" << endl;
 system("pause");
 return 0;
}
 else 
 {
  cout << "Error! Choice invalid!" << endl;
 }
  system("pause");
  return 0;
 }
 
After line 33 you are missing a '}' You would notice a lot easier if you actually indented with tabs instead of spaces.
he's right ^
I'd suggest using an editor such as Notepad++ which can highlight matching braces and simplifies this sort of issue. (Other editors can do this too).

http://notepad-plus-plus.org/


@Chervil code blocks latest will do too... anyways how can i compile c++ in notepad i can only use html
Everyone has their own preferred way of doing things, I use a couple of different IDEs but still like to use Notepad++ too. I've not tried to integrate it with a C++ compiler, but it is possible:
http://heroix.hubpages.com/hub/How-To-Compile-With-Notepad
Topic archived. No new replies allowed.