0

我是 OOP/C++ 的新手。我有三个文件:main.cpp、matrix.cpp 和 matrix.h。我总是遇到错误,它很简单

错误 C2653:“矩阵”:不是类或命名空间名称

错误 C2065:“坟墓”:未声明的标识符

主.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++;
        }
    }
}
4

0 回答 0