does anyone know what the problem is with this? the three main types of errors that i get are:
1. 'class ifstream open' redeclared as different kind of symbol
2. other variables in my program are undeclared
3. 'class ifstream' has no member named 'health'
cout << "1 - Enter a new character's name" << endl;
cout << "2 - Open an existing game" << endl;
cin >> newgame;
char char_name[21] = "";
int money = 10000, menu, num_shotguns = 0, num_hand_guns = 0, health = 100;
if(newgame == 1)
{
cout << "Enter a new character's name" << endl;
cin >> char_name;
}
else
{
cout << "Wait while your saved character is retrieved" << endl;
open.open("char_name",ios::in);
if(open)
{
open.char_name;
open.ignore(80,'\n');
open.health;
open.money;
open.num_hand_guns;
open.num_shotguns;
}
else
{
cout << "An error occurred while opening " << char_name << " information." << endl;
}
open.close();
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
does anyone know what the problem is with this? the three main types of errors that i get are:
1. 'class ifstream open' redeclared as different kind of symbol
2. other variables in my program are undeclared
3. 'class ifstream' has no member named 'health'
cout << "1 - Enter a new character's name" << endl;
cout << "2 - Open an existing game" << endl;
cin >> newgame;
char char_name[21] = "";
int money = 10000, menu, num_shotguns = 0, num_hand_guns = 0, health = 100;
if(newgame == 1)
{
cout << "Enter a new character's name" << endl;
cin >> char_name;
}
else
{
cout << "Wait while your saved character is retrieved" << endl;
open.open("char_name",ios::in);
if(open)
{
open.char_name;
open.ignore(80,'\n');
open.health;
open.money;
open.num_hand_guns;
open.num_shotguns;
}
else
{
cout << "An error occurred while opening " << char_name << " information." << endl;
}
open.close();