Ok i have never used classes but this is a good time to learn . I set it up in my code so what do i do now, i got a ton of errors, what am i doing wrong?
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
|
#include <iostream>
#include <ctime>
#include <random>
#include <string>
#include <fstream>
#include <windows.h>
using namespace std;
class Company
{
public:
Company ();
Company (string scname, string plrname);
void LOADGAME();
void SAVEGAME();
void MAINPROGRAM();
void NEWGAMESTART();
private:
string scname;
string plrname;
};
void MAINPROGRAM();
void NEWGAMESTART();
void SAVEGAME();
void LOADGAME();
int main()
{
string choice;
string scname;
string plrname;
cout << "New" << endl;
cout << "Load" << endl;
cin >> choice;
if(choice == "New" || choice == "new")
{
NEWGAMESTART(plrname, scname);
}
else if(choice == "Load" || choice == "load")
{
MAINPROGRAM(plrname, scname);
}
}
void NEWGAMESTART()
{
if(cin.peek() == '\n')
{
cin.ignore();
}
cout << "Welcome to Shipping Supplies" << endl;
cout << "Please enter the name of your shipping company" << endl;
getline(cin, scname);
cout << "\n";
cout << "Ok so the name of your company is " << scname << endl;
cout << "\n";
cout << "And what is your name?" << endl;
getline(cin, plrname);
cout << "Ok " << plrname << " welcome to the game! lets get started" << endl;
cout << "\n";
if(WM_QUIT)
{
SAVEGAME(scname, plrname);
}
}
void MAINPROGRAM()
{
cout << scname << endl;
cout << "\n";
if(WM_QUIT)
{
SAVEGAME(scname, plrname);
}
}
void SAVEGAME()
{
ofstream file("SS.txt");
file << "Shipping Company Player Data" << endl;
file << "\n";
file << scname << endl;
file << plrname << endl;
}
void LOADGAME()
{
ifstream file("SS.txt");
file >> scname;
file >> plrname;
}
|
ERRORS:
C:\Users\Chay Hawk\Desktop\Guess\main.cpp||In function 'int main()':|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|25|error: too many arguments to function 'void NEWGAMESTART()'|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|41|error: at this point in file|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|24|error: too many arguments to function 'void MAINPROGRAM()'|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|45|error: at this point in file|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp||In function 'void NEWGAMESTART()':|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|58|error: 'scname' was not declared in this scope|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|63|error: 'plrname' was not declared in this scope|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp||In function 'void MAINPROGRAM()':|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|75|error: 'scname' was not declared in this scope|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|81|error: 'plrname' was not declared in this scope|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp||In function 'void SAVEGAME()':|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|92|error: 'scname' was not declared in this scope|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|93|error: 'plrname' was not declared in this scope|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp||In function 'void LOADGAME()':|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|100|error: 'scname' was not declared in this scope|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|101|error: 'plrname' was not declared in this scope|
||=== Build finished: 12 errors, 0 warnings ===|