Help with code, please. the problem is with the fstream
Errors:
Code:
c:\dev-c_~1\goalke~1.cpp: In function `int main()':
c:\dev-c_~1\goalke~1.cpp:14: no matching function for call to `fstream::fstream (const char[9])'
C:\DEV-C_~1\INCLUDE\G__~1\fstream.h:83: candidates are: fstream::fstream()
C:\DEV-C_~1\INCLUDE\G__~1\fstream.h:84: fstream::fstream(int)
C:\DEV-C_~1\INCLUDE\G__~1\fstream.h:86: fstream::fstream(const char *, int, int = 436)
C:\DEV-C_~1\INCLUDE\G__~1\fstream.h:87: fstream::fstream(int, char *, int)
C:\DEV-C_~1\INCLUDE\G__~1\fstream.h:90: fstream::fstream(const fstream &)
c:\dev-c_~1\goalke~1.cpp:15: no matching function for call to `fstream::open ()'
C:\DEV-C_~1\INCLUDE\G__~1\fstream.h:89: candidates are: void fstream::open(const char *, int, int = 436)
c:\dev-c_~1\goalke~1.cpp:34: assignment to `char' from `const char *' lacks a cast
c:\dev-c_~1\goalke~1.cpp:37: `toupper' undeclared (first use this function)
c:\dev-c_~1\goalke~1.cpp:37: (Each undeclared identifier is reported only once
c:\dev-c_~1\goalke~1.cpp:37: for each function it appears in.)
c:\dev-c_~1\goalke~1.cpp:43: implicit declaration of function `int system(...)'
c:\dev-c_~1\goalke~1.cpp: In function `int first()':
c:\dev-c_~1\goalke~1.cpp:54: no matching function for call to `fstream::fstream (const char[9])'
C:\DEV-C_~1\INCLUDE\G__~1\fstream.h:83: candidates are: fstream::fstream()
C:\DEV-C_~1\INCLUDE\G__~1\fstream.h:84: fstream::fstream(int)
C:\DEV-C_~1\INCLUDE\G__~1\fstream.h:86: fstream::fstream(const char *, int, int = 436)
C:\DEV-C_~1\INCLUDE\G__~1\fstream.h:87: fstream::fstream(int, char *, int)
C:\DEV-C_~1\INCLUDE\G__~1\fstream.h:90: fstream::fstream(const fstream &)
I suck, huh
The Code:
Code:
#include <iostream.h>
#include <fstream.h>
int first();
int main()
{
char goal[20];
int show;
int done;
char quitting;
bool check;
cout <<"Neurosoft Technology presents"<< endl;
cout <<"Goalkeeper 2003"<< endl;
cin.get();
fstream a_file("goal.goa");
check = a_file.open();
if(check = "TRUE")
{
goto prog;
}
else
{
first();
}
prog:
for(show=0; show < 20; show ++)
{
cout << show + 1 << ". " << goal[show] << endl;
}
int going = 0;
while(going == 0)
{
cout << "Which goal is done?" << endl;
cin >> done;
goal[done-1] += " --- DONE";
cout << "[Q] - Quit /n [S] - Stay /n" << endl;
cin >> quitting;
quitting = toupper[quitting];
if(quitting == 'Q')
{
cout << "Thank you for using NeuroSoft Technology's /n Goalkeeper 2003 /n";
going = 1;
}
system("PAUSE");
return 0;
}
}
int first()
{
int turn = 0;
char quit;
char goal[20] = {0};
int max = 0;
fstream a_file("goal.goa");
for(turn=0; turn=0; max++)
{
cout <<"Insert Goal " << max + 1 << "." << endl;
cin >> goal[max];
cout << "That is "<< max+1 << "out of 20 goals" << endl;
a_file << goal[max];
cout << "[Q]-Quit /n [C]-Continue /n ";
cin >> quit;
quit = toupper(quit);
if(quit=='Q')
{
a_file.close();
turn=1;
}
}
system("PAUSE");
return 0;
}