
Error de sintaxis ==
Publicado por Aaron (1 intervención) el 09/11/2021 02:20:11
Hola me salta un error por alguna razon sobre error de sitaxis, la idea era programar el juego de la batalla naval para un parcial de la materia programacion el codigo es el siguiente:
#include <iostream>
#include <windows.h>
#include <conio.h>
using namespace std;
void gotoxy(int x, int y) {
HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
COORD dwPos;
dwPos.X = x;
dwPos.Y = y;
SetConsoleCursorPosition(hcon, dwPos);
}
class enemigo {
private:
public:
void pintar(int, int);
void mover(int, int);
};
void enemigo::pintar(int x, int y)
{
gotoxy(5, 5); cout << "A";
if (_kbhit())
{
const char tecla = _getch();
if ( tecla == "a") x--;
if (tecla == "d") x++;
if (tecla == "s") y--;
if ( tecla == "w") y++;
}
}
int main()
{
enemigo a;
while (true){
a.mover(5, 5);
}
}
GRACIAS :)
#include <iostream>
#include <windows.h>
#include <conio.h>
using namespace std;
void gotoxy(int x, int y) {
HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
COORD dwPos;
dwPos.X = x;
dwPos.Y = y;
SetConsoleCursorPosition(hcon, dwPos);
}
class enemigo {
private:
public:
void pintar(int, int);
void mover(int, int);
};
void enemigo::pintar(int x, int y)
{
gotoxy(5, 5); cout << "A";
if (_kbhit())
{
const char tecla = _getch();
if ( tecla == "a") x--;
if (tecla == "d") x++;
if (tecla == "s") y--;
if ( tecla == "w") y++;
}
}
int main()
{
enemigo a;
while (true){
a.mover(5, 5);
}
}
GRACIAS :)
Valora esta pregunta


0