我是OOP / C ++的新手。我有三个文件:main.cpp,matrix.cpp和matrix.h。我一直都会遇到错误,它是sasys
错误C2653:'matrix':不是类或命名空间名称
错误C2065:'tomb':未声明的标识符
main.cpp中:
#include "stdafx.h"
#include "matrix.h"
int _tmain(int argc, _TCHAR* argv[])
{
matrix m;
return 0;
}
matrix.h:
#ifndef MATRIX_H
#define MATRIX_H
class matrix{
private:
int tomb[3][3];
public:
matrix(); //default konstruktor
};
#endif
matrix.cpp
#include "matrix.h"
#include "stdafx.h"
#include <iostream>
matrix::matrix(){
unsigned int x=0, y=0;
for(unsigned int i = 0; i<9; i++){
std::cout << "Kerem a(z) " << i << ". szamot" << std::endl;
std::cin >> matrix::tomb[x][y];
if(y<2) y++;
else{
y =0;
x++;
}
}
}