Xavistian

Zig Zag sin terminar

Jun 22nd, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.37 KB | None | 0 0
  1. // ConsoleApplication1.cpp : main project file.
  2.  
  3. #include "stdafx.h"
  4. #include <conio.h>
  5. #include <iostream>
  6. using namespace std;
  7. using namespace System;
  8.  
  9. void genera_y_muestra_matriz(int Matriz[20][23])
  10. {
  11.     int xx, yy;
  12.     for (int i = 0; i < 20; i++)
  13.     {
  14.         Console::SetCursorPosition(xx, yy);
  15.         for (int j = 0; j < 23; j++)
  16.         {
  17.             switch (Matriz[i][j])
  18.             {
  19.             case 1: Console::BackgroundColor = ConsoleColor::DarkBlue;
  20.                 Console::ForegroundColor = ConsoleColor::Yellow;
  21.                     cout << (char)219;break;
  22.             case 0: Console::BackgroundColor = ConsoleColor::DarkBlue;
  23.                     Console::ForegroundColor = ConsoleColor::Yellow;
  24.                     cout << ' ';break;
  25.  
  26.             }
  27.         }yy++;
  28.     }
  29. }
  30. void desplazar_movil(int Matriz[20][23])
  31. {
  32.     int ex=10, ey=10, dex=1, dey = 1;
  33.     _sleep(50);
  34.     Console::SetCursorPosition(10, 10);
  35.     cout << ' ';
  36.     if (ex == 22||ex==0)dex *= -1;
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44. }
  45. int main()
  46. {
  47.     int Matriz[20][23] = {
  48.     //0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22
  49.      {0,0,0,0,0,0,0,0,0,0,0, 0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0,},//0
  50.      {1,1,1,1,1,1,1,1,1,1,1, 1, 1, 1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1,},//1
  51.      {1,1,0,0,0,0,0,0,0,0,0, 0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ,1,},//2
  52.      {0,1,1,0,0,0,0,0,0,0,0, 0, 0, 0 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