Below is a small part of the definition of the class.. I have not provided all of it as I dont have questions on the rest of it.... I was wondering how I am supposed to open a txt file in the class constructor target....
Expand|Select|Wrap|Line Numbers
- class target
- {
- // Definition for class target
- // Class target contains the internal logic for the game of target
- // (user interaction is outside the class in application program)
- //
- public:
- target();
- // default constructor
- // Opens small default dictionary ("dict.txt") and reads words into
- // vector wordList
- // Default dictionary contains only lower case words of length 4-9
- // Sets centreLetter and otherLetters to spaces.
I will definately be asking my tutor for help this week in class but I would really like to make a start on it!
Expand|Select|Wrap|Line Numbers
- target :: target()
- // default constructor
- // Opens small default dictionary ("dict.txt") and reads words into
- // vector wordList
- // Default dictionary contains only lower case words of length 4-9
- // Sets centreLetter and otherLetters to spaces.
- {
- ifstream infile;
- string fname;
- int data;
- infile.open(fname.c_str());
- if (infile.fail())
- {
- cout << "File not found " << endl;
- return EXIT_FAILURE;
- }
- infile >> data;
- }
K.