Linker Error

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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#include <iostream.h>
#include <conio.h>
#include<fstream.h>
#include <process.h>
int main()
{
int ch;
char x;

do
{
     cout <<"Hello And Welcome To Dsz Cinemas\n";
     cout <<"Please Type In The Number Of Your Choice\n";
     cout <<"1. Booking Tickets\n";
     cout <<"2. Latest Updates\n";
     cout <<"3. Gold Membership\n";          //prob is in this selection
     cout <<"4. Credits\n";
     cin >>ch;
     system("cls");
     
     if (ch==3) //must put the login info under here
     {
         cout <<"Welcome to our gold membership\n";
                using namespace std;
                void Auth();
                void Members();
                void Userchange();
                void Passchange();
                
                string inuser;
                string inpass;
                string user;
                int num = 0;
                int ch;
                char pass[BUFSIZ];
                int i = 0;
                string com;
                
                main();
                {
                       system("cls");
                       cout<<"Welcome\n---------------------------\n\n";
                       while(num==0)
                       {
                                    system("cls");
                                    cout<<"Command: ";
                                    cin>>com;
                                    if(com=="login")
                                    {
                                                    Auth();
                                    }
                                    else if(com=="change-pass")
                       {
                                    Passchange();
                       }
                       else if(com=="change-user")
                {
                       Userchange();
                }
                else if(com==com)
                {
                     cout<<"Unknown command\n";
                     }
                }
     }
     void Auth();
     {
          ifstream Passfile("password.txt", ios::in);
          Passfile>>inpass;
          ifstream Userfile("username.txt", ios::in);
          Userfile>>inuser;
          system("cls");
          cout<<"USERNAME: ";
          cin>>user;
          cout<<"PASSWORD: ";
          fflush(stdout);
          
          while ((ch = getch()) != EOF 
          && ch != '\n' 
          && ch != '\r' 
          && i < sizeof(pass) - 1)
          {
               if (ch == '\b' && i > 0) 
               {
                      printf("\b \b");
                      fflush(stdout);
                      i--;
                      pass[i] = '\0';
                      }
                      else if (isalnum(ch))
                      {
                           putchar('*');
                           pass[i++] = (char)ch;
                      }
               }
               pass[i] = '\0';
               Userfile.close();
               Passfile.close();
               if(user==inuser&&pass==inpass)
               {
                            Members();
               }
                            else
               {
                            cout<<"nope";
                            getch();
                            main();
                            }
               }
               void Userchange();
               {
                    string tempass;
                    system("cls");
                    cout<<"enter current password: ";
                    cin>>tempass;
                    if(tempass==inpass)
                    {
                                       cout<<"utility to change username stored in file\n";
                                       cout<<"CHANGE USER TO: ";
                                       cin>>user;
                                       ofstream Userfile("username.txt", ios::out);
                                       Userfile<<user;
                                       Userfile.close();
                                       cout<<"Username successfully changed";
                                       getch();
                                       main();
                    }
                                       else
                                       {
                                           cout<<"Invalid Password";
                                           getch();
                                           main();
                                       }
                    }
                    void Passchange();
                    {
                         string pass;
                         system("cls");
                         cout<<"enter current password: ";
                         fflush(stdout);
                         while ((ch = getch()) != EOF 
                         && ch != '\n' 
                         && ch != '\r' 
                         && i < sizeof(pass) - 1)
                         {
                              if (ch == '\b' && i > 0) 
                              {
                                     printf("\b \b");
                                     fflush(stdout);
                                     i--;
                                     pass[i] = '\0';
                                     }
                                     else if (isalnum(ch))
                                     {
                                          putchar('*');
                                          pass[i++] = (char)ch;
                                     }
                              }
                              pass[i] = '\0';
                              if(pass==inpass)
                              {
                                              cout<<"utility to change password stored in file\n";
                                              cout<<"CHANGE PASS TO: ";
                                              cin>>user;
                                              ofstream Passfile("password.txt", ios::out);
                                              Passfile<<user;
                                              Passfile.close();
                                              cout<<"password successfully changed";
                                              getch();
                                              main();
                              }
                                              else
                                              {
                                                  cout<<"Invalid Password: ";
                                                  getch();
                                                  main();
                                              }
                         }
                         void Members();
                         {
                              system ("cls");
                              cout <<"wassup";
                              cout<<"nothing";
                              getch ();// put members code here
                              // like a while(){} loop or somethin like that
                              // comment please
                         }
                         
}


else if (ch>4)
     cout <<"The number typed in is wrong Dum Dum =P\n\n\n\n";
     
     
     cout<<"\n\nDo you wish to redo your selection and select another option or exit? (Y/N)\n";
     cin>>x;
     system("cls");
}
while (x=='Y'||x=='y');
cout <<"Thankyou for choosing Dsz Cinemas!!!\nSorry for any inconvenience\nHope to see you again ^.^ :D\nBye"; 
getch();
exit(0);

getch();
}
Last edited on
For one, your headers are not properly included. Try this:
1
2
3
4
5
6
#include <iostream>
#include <conio.h>
#include <fstream>
#include <process.h>

using namespace std;


Edit: The comments of the other members in the "General C++ Programming" section duplicate thread (http://www.cplusplus.com/forum/general/88977/#msg477667) , in conjunction to properly including the headers, should have this work for you as intended. You may want to look into the structure of C++ functions as already suggested though:

http://www.cplusplus.com/doc/tutorial/functions/
Last edited on
Topic archived. No new replies allowed.