Im trying to read from a file using classes and objects. i keep getting this error
main.cpp:16: error: no matching function for call to ‘Game::fillGame()’
Game.h:41: note: candidates are: bool Game::fillGame(std::ifstream&)
here is code that goes with the error
//Game.h
bool fillGame(ifstream & din);
//Game.cpp
#include<iostream>
#include "Game.h"
bool Game::fillGame(ifstream &din)
{
int round_Of;
ifstream din;
din.open("file.txt");
if(!din)
cout << "Error: file could not be found";
else
{
din >> round_Of;
while(!din.eof())
{
cout << round_Of;
din >> round_Of;
}
cout << endl << endl;
din.close();
}
}
//main.cpp
#include "Game.h"
#include<iostream>
#include<cstring>
#include<iomanip>
#include<cctype>
#include<fstream>
#include<string>
int main()
{
Game output;
output.fillGame();
return 0;
}