for some reason im having trouble getting my program to even compile now i will include the errors and the header and body files for reference
thanks
game.h:11: error: âifstreamâ has not been declared
game.h:12: error: expected â,â or â...â before âFilenameâ
game.h:12: error: ISO C++ forbids declaration of âstringâ with no type
game.h:17: error: âstringâ does not name a type
#include <fstream>
#include <string>
class Game
{
public:
Game();
Game (const Game &OtherGame);
~Game();
void GetData(ifstream &Input);
void Fill(const string Filename);
void Print() const;
private:
int games;
int numgames;
string rival;
int HomeScore;
int RivalScore;
};
the 'game.h:17:' error refers to the face that you have delcared usingnamespace std; after you have tried to declare a string variable. For this to work you would have to write std::string. But you should just move that line to the very top and keep all includes and using's together, or probably just not use using
Also, don't think (ifstream &input) is valid! You can't have ifstream as the parameter type!
hw7.cpp:12: error: no matching function for call to âGame::GetData(const char [9])â
game.h:12: note: candidates are: void Game::GetData(std::ifstream&)
alright i fixed all the previous probems and have a problem i have never encountered
1 2
game.cpp: In member function âvoid Game::Fill(std::string)â:
game.cpp:53: error: request for member âGetDataâ in â((Game*)this)->Game::games[((Game*)this)->Game::numgames]â, which is of non-class type âintâ
and the function the line is in is the while(games[numgames].GetData(Din))