so like this?
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
|
#include <iostream>
#include <ctime>
#include <random>
#include <string>
#include <fstream>
#include <windows.h>
using namespace std;
class Company
{
public:
Company () // default constructor
{
scname = "";
plrname = "";
}
Company (string scname, string plrname)
{
scname = scname;
plrname = plrname;
}
void LOADGAME();
void SAVEGAME();
void MAINPROGRAM();
void NEWGAMESTART();
private:
string scname;
string plrname;
};
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;
}
| |
you said do the void company:: functionname
thing to them but i cant do it to main can i?
errors
||=== Guess, Debug ===|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp||In function 'int main()':|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|44|error: 'NEWGAMESTART' was not declared in this scope|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|48|error: 'MAINPROGRAM' was not declared in this scope|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp||In function 'void NEWGAMESTART()':|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|61|error: 'scname' was not declared in this scope|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|66|error: 'plrname' was not declared in this scope|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|72|error: 'SAVEGAME' 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|78|error: 'scname' was not declared in this scope|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|84|error: 'plrname' was not declared in this scope|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|84|error: 'SAVEGAME' 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|95|error: 'scname' was not declared in this scope|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|96|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|103|error: 'scname' was not declared in this scope|
C:\Users\Chay Hawk\Desktop\Guess\main.cpp|104|error: 'plrname' was not declared in this scope|
||=== Build finished: 12 errors, 0 warnings ===|