I'm getting a few errors when I try to compile my code and I have no idea how to fix them
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
|
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
#include "input.dat"
class sudoku{
private:
const int row;
const int col;
int game[][9];
public:
void readNumbersIn();
};//end class
void sudoku::readNumbersIn()
{
int game[row][col];
ifstream fin;
fin.open("input.dat");
for(int i=0; i<row; i++)
{
for(int j=0; j<col; j++)
{
fin >> game[row][col];
}
}
for(int i=0; i<row; i++)
{
for(int j=0; j<col; j++)
{
cout << game[row][col] << " ";
}
cout << endl;
}
}//end void readNumbersIn
|
the input.dat file contains
1 2 3 4 5 6 7 8 9
|
4 3 5 2 6 9 7 8 1
6 8 2 5 7 1 4 9 3
1 9 7 8 3 4 5 6 2
8 2 6 1 9 5 3 4 7
3 7 4 6 8 2 9 1 5
9 5 1 7 4 3 6 2 8
5 1 9 3 2 6 8 7 4
2 4 8 9 5 7 1 3 6
7 6 3 4 1 8 2 5 9
|
the errors are:
input.dat:1: error: expected unqualified-id before numeric constant
homework13.h:18: error: âsudokuâ has not been declared
homework13.h: In function âvoid readNumbersIn()â:
homework13.h:21: error: ârowâ was not declared in this scope
homework13.h:21: error: âcolâ was not declared in this scope
homework13.h:29: error: âgameâ was not declared in this scope
homework13.h:37: error: âgameâ was not declared in this scope
1) why are my delcarations not being passed from my class?
2) i dont understand the error in my input.dat file