Dev - C++ - problema al compilar en VS2015 C++

 
Vista:

problema al compilar en VS2015 C++

Publicado por brando guevara gamonal (1 intervención) el 23/06/2019 01:06:42
nose porque no me compila esto, soy nuevo en c++, estoy usando VS 2015 en c++

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
#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,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,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;
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder