[ Foro de C++ ]
cuando le doy a compilar este codigo de c++, no me compila me aparece errores y nose porque, pero en otras PC carga normal
#include "stdafx.h"
#include "iostream"
#include "conio.h"
#include "time.h"
#include <windows.h>
using namespace System;
using namespace std;
int Matriz[24][79];
int MNiveL1[24][79] = {
{ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 },
{ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 },
{ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 },
{ 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1 },
{ 1,0,1,0,1,0,1,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,1,0,1,0,1,0,1 },
{ 1,0,1,0,1,0,1,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2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
{ 1,0,1,0,1,0,1,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,1,0,1,0,1,0,1 },
{ 1,0,1,0,1,0,1,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,1,0,1,0,1,0,1 },
{ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 },
{ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 },
{ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }
};
void DibujaRed(int &x, int &y, int &cx, int &cy)
{
Console::ForegroundColor = ConsoleColor::Yellow;
Console::SetCursorPosition(cx, cy); cout << char(196);
Console::SetCursorPosition(cx + 1, cy); cout << char(196);
Console::SetCursorPosition(cx + 2, cy); cout << char(196);
Console::SetCursorPosition(cx + 3, cy); cout << char(196);
Console::SetCursorPosition(cx + 4, cy); cout << char(196);
Console::SetCursorPosition(cx + 5, cy); cout << char(196);
Console::SetCursorPosition(cx + 6, cy); cout << char(196);
Console::SetCursorPosition(cx + 7, cy); cout << char(196);
Console::SetCursorPosition(cx + 8, cy); cout << char(196);
Console::SetCursorPosition(cx + 9, cy); cout << char(196);
Console::SetCursorPosition(cx + 10, cy); cout << char(196);
Console::SetCursorPosition(x, y + 1); cout << "|";
Console::SetCursorPosition(x, y + 2); cout << "|";
Console::SetCursorPosition(x, y + 3); cout << "|";
Console::SetCursorPosition(x, y + 4); cout << "|";
Console::SetCursorPosition(x, y + 5); cout << "|";
}
void BorraRed(int &x, int &y)
{
Console::ForegroundColor = ConsoleColor::Yellow;
Console::SetCursorPosition(x, y); cout << " ";
Console::SetCursorPosition(x, y + 1); cout << " ";
Console::SetCursorPosition(x, y + 2); cout << " ";
Console::SetCursorPosition(x, y + 3); cout << " ";
Console::SetCursorPosition(x, y + 4); cout << " ";
Console::SetCursorPosition(x, y + 5); cout << " ";
}
void ImprimeMapa(int Nivel)
{ //indique las letras de los niveles
Console::SetCursorPosition(80, 0);
cout << "NIVEL " << Nivel;
for (int i = 0; i < 24; i++)
for (int j = 0; j < 79; j++)
{ // la ubicacion del cuadro en 0,0
Console::SetCursorPosition(j, i);
if (Matriz[i][j] == 0)
cout << " "; //vacios
if (Matriz[i][j] == 1)
{
Console::ForegroundColor = ConsoleColor::Gray;
cout << (char)219; // paredes
}
if (Matriz[i][j] == 2)
{
Console::ForegroundColor = ConsoleColor::Cyan;
cout << (char)219; // agua
}
}
}
void imprimirvidas(int vidas)
{
Console::SetCursorPosition(80, 2);
Console::ForegroundColor = ConsoleColor::White;
cout << "vidas: " << vidas;
}
void imprimetiempo()
{
Console::SetCursorPosition(80, 4);
Console::ForegroundColor = ConsoleColor::White;
int tiempo = 180;
for (int i = tiempo; i >= 0; i--)
{
system("cls");
cout << "tiempo: " << i << endl;
Sleep(10);
if (tiempo == 0)
{
cout << "Fin del juego";
_getch();
}
}
}
void imprimirpuntaje()
{
int puntaje = 0;
Console::SetCursorPosition(80, 3);
Console::ForegroundColor = ConsoleColor::White;
cout << "puntaje: " << puntaje;
}
void NiveL1()
{
//la matriz estandar toma el valor de la matriz del nivel 1
int vidas = 3;
for (int i = 0; i < 24; i++)
for (int j = 0; j < 79; j++)
Matriz[i][j] = MNiveL1[i][j];
ImprimeMapa(1);
imprimirvidas(vidas);
imprimirpuntaje();
}
void NiveL2()
{
//la matriz estandar toma el valor de la matriz del nivel 1
int vidas = 3;
for (int i = 0; i < 24; i++)
for (int j = 0; j < 79; j++)
Matriz[i][j] = MNiveL1[i][j];
ImprimeMapa(2);
imprimirvidas(vidas);
imprimirpuntaje();
}
struct pez {
int border;
int Mx;
int My;
int dirp;
pez(int Mx, int My) {
this->Mx = Mx;
this->My = My;
border = 67;
dirp = 1;
}
void DibujaPez()//cordenadas donde aparece el pez
{
Console::SetCursorPosition(Mx, My);
Console::ForegroundColor = ConsoleColor::Yellow;
if (dirp == 1)
{
Console::SetCursorPosition(Mx, My + 1); cout << "><^>";
}
else
{
Console::SetCursorPosition(Mx, My + 1); cout << "<^><";
}
}
void BorraPez()
{
Console::SetCursorPosition(Mx, My);
Console::ForegroundColor = ConsoleColor::Yellow;
Console::SetCursorPosition(Mx, My + 1); cout << " ";
}
void Mover_pez()
{
BorraPez();
if (Mx + dirp >= border)
{
dirp = dirp * (-1);
}
else if (Mx + dirp <= 9)
{
dirp = dirp * (-1);
}
Mx = Mx + dirp;
DibujaPez();
}
void MovimientoPez()
{
DibujaPez();
_sleep(60);
BorraPez();
Mover_pez();
DibujaPez();
}
};
struct tiburon {
int tibux = 9;
int tibuy = 5;
int border = 67;
int dir = 1;
void dibujodeltiburon()
{
Console::SetCursorPosition(tibux, tibuy);
Console::ForegroundColor = ConsoleColor::Red;
if (dir == 1)
{
Console::SetCursorPosition(tibux, tibuy + 1); cout << "><^>";
}
else
{
Console::SetCursorPosition(tibux, tibuy + 1); cout << "<^><";
}
}
void eliminartiburon()
{
Console::SetCursorPosition(tibux, tibuy);
Console::ForegroundColor = ConsoleColor::Red;
Console::SetCursorPosition(tibux, tibuy + 1); cout << " ";
}
void mover_tiburon()
{
eliminartiburon();
tibux = tibux + dir;
if (tibux + dir >= border)
{
dir = dir * (-1);
}
else if (tibux + dir <= 10)
{
dir = dir * (-1);
}
dibujodeltiburon();
}
void movimiento_tiburon()
{
dibujodeltiburon();
_sleep(60);
eliminartiburon();
mover_tiburon();
dibujodeltiburon();
}
};
void Movimiento()
{
NiveL1();
int cx = 1, cy = 1; //coordenadas de la parte horizontal de la caña de pescar
int X = 12, Y = 1; //coordenadas de la parte vertical de la caña de pescar
Console::CursorVisible = false;
char Tecla;
Console::SetCursorPosition(X, Y);
DibujaRed(X, Y, cx, cy);
tiburon*t1 = new tiburon;
pez*p1 = new pez(9, 8);
pez*p2 = new pez(22, 8);
pez*p3 = new pez(35, 8);
pez*p4 = new pez(48, 8);
pez*p5 = new pez(9, 10);
pez*p6 = new pez(22, 10);
pez*p7 = new pez(35, 10);
pez*p8 = new pez(48, 10);
pez*p9 = new pez(14, 12);
pez*p10 = new pez(27, 12);
pez*p11 = new pez(40, 12);
pez*p12 = new pez(9, 14);
pez*p13 = new pez(22, 14);
pez*p14 = new pez(35, 14);
pez*p15 = new pez(14, 16);
pez*p16 = new pez(27, 16);
pez*p17 = new pez(40, 16);
pez*p18 = new pez(9, 18);
pez*p19 = new pez(22, 18);
pez*p20 = new pez(35, 18);
while (1)
{
while (!kbhit())
{
_sleep(10);
t1->mover_tiburon();
_sleep(100);
p1->Mover_pez();
p2->Mover_pez();
p3->Mover_pez();
p4->Mover_pez();
p5->Mover_pez();
p6->Mover_pez();
p7->Mover_pez();
p8->Mover_pez();
p9->Mover_pez();
p10->Mover_pez();
p11->Mover_pez();
p12->Mover_pez();
p13->Mover_pez();
p14->Mover_pez();
p15->Mover_pez();
p16->Mover_pez();
p17->Mover_pez();
p18->Mover_pez();
p19->Mover_pez();
p20->Mover_pez();
}
Tecla = getch();
Console::SetCursorPosition(X, Y);
BorraRed(X, Y);
if (Tecla == 72) //arriba
{
Y--;
if (Y == 0)
Y++;
}
if (Tecla == 80) //abajo
{
Y++;
if (Y == 16)
Y--;
}
Console::SetCursorPosition(X, Y);
DibujaRed(X, Y, cx, cy);
}
}
int main()
{
Movimiento();
_getch();
return 0;
}
Estás usando bibliotecas "anticuadas", como "conio.h". Aun así, ¿cuáles son esos errores que te da?
(No se puede continuar esta discusión porque tiene más de dos meses de antigüedad. Si tienes dudas parecidas, abre un nuevo hilo.)