我是C++的新手,我在OCaml和Python方面有更多的经验.我想通过制作一个播放"Morpion Solitaire"的程序来学习C++.我的开始有点困难.
在以下代码中:
typedef enum {NORTH, NORTHEAST, EAST, SOUTHEAST} direction;
char deltax[4] = { 0, 1, 1, 1};
char deltay[4] = { 1, 1, 0, -1};
class Coords {
private:
char x,y;
public:
Coords(char xx,char yy){
x = xx;
y = yy;
};
char get_x() const { return x;}
char get_y() const { return y;}
};
class Line {
private:
Coords orig;
direction dir;
Coords newcross;
public:
Line(char x1, char y1, direction d, char x2, char y2) {
orig = …Run Code Online (Sandbox Code Playgroud) c++ ×1