【发布时间】:2023-03-09 17:54:01
【问题描述】:
我在编译时遇到了我的代码 c++ 的问题。 ^
这是完整的代码,错误行刚刚包含
#include <string>
#include <iostream>
#include <cstdlib>
#include <cstdio>
//#include <conio.h>
#include <ncurses.h>
#include <time.h>
using namespace std;
const char KEY_LEFT = 'a', KEY_RIGHT = 'd',KEY_UP = 'w', KEY_DOWN ='s';
const int HEIGHT = 25, WIDTH = 40;
bool hasntWon = true;
int hP = 100;
//unsigned char healthbar [10] = {'*','*','*','*','*','*','*','*','*','*'};
enum DirectionX {Right,Left};
enum DirectionY {Up,Down};
struct Player {
char sprite;
int x;
int y;
};
struct Enemy{
char sprite;
int x;
int y;
DirectionX pastDirX;
DirectionY pastDirY;
};
【问题讨论】:
-
请贴出未编译的文件内容。记住要缩进带有四个空格的行以正确格式化。
-
没有发布代码 == 没有帮助。
-
请记住,使用 text 编辑您的帖子,而不是代码的屏幕快照。屏幕快照不能很好地粘贴到 IDE 中。
-
尝试对字符使用
char,而不是整数。 -
总是发布错误消息的完整文本(逐字和在问题中)。
标签: c++