OOP/C++ は初めてです。main.cpp、matrix.cpp、matrix.h の 3 つのファイルがあります。私はいつもエラーが発生しています、それはsasysです
エラー C2653: 'matrix': クラスまたは名前空間の名前ではありません
エラー C2065: 'tomb': 宣言されていない識別子
main.cpp:
#include "stdafx.h"
#include "matrix.h"
int _tmain(int argc, _TCHAR* argv[])
{
matrix m;
return 0;
}
マトリックス.h:
#ifndef MATRIX_H
#define MATRIX_H
class matrix{
private:
int tomb[3][3];
public:
matrix(); //default konstruktor
};
#endif
マトリックス.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++;
}
}
}