Well, so running the code I found a few errors listed here in the order of chance to be what causes the program to fail to compile:
Lastly, please find some way to rate whoever is teaching you as lowly as possible, because using Turbo C++ in a world where GCC, and Clang exist is plain and simply unacceptable.
(also consider deleting this thread to remove the evidence of you asking for help, if this works)
-
emp.eof()
should probably beempfile.eof()
.
-
cout<
should probably becout<<
.
-
goto-statements end with a;not a:.
-
int *get_code()
should probably beint get_code()
.
-
main
is supposed to returnint.
- Initialization of
ofstream o;is skipped, when jumping tocase 5:
. (add{aftercase 4:
, and}beforecase 5:
)
-
using namespace std;
to drag whatever is in the headers into the global namespace.
-
ios::noreplace
isn't a thing anymore, same thing goes forclrscr()
andsleep()
.
-
#include <iostream>and#include <fstream>, instead of#include <fstream.h>.
-
nc=emp.get_code()
should probably benc==emp.get_code()
.
-
getsis super unsafe (what happens if the user enters more characters than you have in your buffer?). Consider usingfgetsorgetline
[/codei]).
-
empfile.seekp(empfile.tellg() - sizeof(emp)
is ambiguous. Castsizeof(emp)
tostreamlen
(probably safe to ignore, and Turbo C++ might not supportstreamlen
).
Lastly, please find some way to rate whoever is teaching you as lowly as possible, because using Turbo C++ in a world where GCC, and Clang exist is plain and simply unacceptable.
(also consider deleting this thread to remove the evidence of you asking for help, if this works)
Age ratings for movies and games (and similar) have never been a good idea.
One can learn a lot from reinventing wheels.
An unsound argument is not the same as an invalid one.
volatile in C++ does not mean thread-safe.
Do not make APIs unnecessarily asynchronous.
Make C++ operator > again
Trump is an idiot.
One can learn a lot from reinventing wheels.
An unsound argument is not the same as an invalid one.
volatile in C++ does not mean thread-safe.
Do not make APIs unnecessarily asynchronous.
Make C++ operator > again
Trump is an idiot.

Chat

