Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication1.cpp : main project file.
- #include "stdafx.h"
- #include <conio.h>
- #include <iostream>
- using namespace std;
- using namespace System;
- void genera_y_muestra_matriz(int Matriz[20][23])
- {
- int xx, yy;
- for (int i = 0; i < 20; i++)
- {
- Console::SetCursorPosition(xx, yy);
- for (int j = 0; j < 23; j++)
- {
- switch (Matriz[i][j])
- {
- case 1: Console::BackgroundColor = ConsoleColor::DarkBlue;
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << (char)219;break;
- case 0: Console::BackgroundColor = ConsoleColor::DarkBlue;
- Console::ForegroundColor = ConsoleColor::Yellow;
- cout << ' ';break;
- }
- }yy++;
- }
- }
- void desplazar_movil(int Matriz[20][23])
- {
- int ex=10, ey=10, dex=1, dey = 1;
- _sleep(50);
- Console::SetCursorPosition(10, 10);
- cout << ' ';
- if (ex == 22||ex==0)dex *= -1;
- }
- int main()
- {
- int Matriz[20][23] = {
- //0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22
- {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,0,0,0,0,0,0,0,0,0, 0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ,1,},//2
- {0,1,1,0,0,0,0,0,0,0,0, 0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ,1 ,0,},//3
- {0,0,1,1,0,0,0,0,0,0,0, 0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,1 ,1 ,0 ,0,},//4
- {0,0,0,1,1,0,0,0,0,0,0, 0, 0, 0 ,0 ,0 ,0 ,0 ,1 ,1 ,0 ,0 ,0,},//5
- {0,0,0,0,1,1,0,0,0,0,0, 0, 0, 0 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