avr39-ripe

frameCycle

Mar 9th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <chrono>
  4. #include <thread>
  5. const int maxCord = 10;
  6.  
  7. const int maxLoop = maxCord / 2 ;
  8. const int minLoop = 0;
  9. int loopStep = 1;
  10. int loop = minLoop;
  11.  
  12. using namespace std;
  13. int main()
  14. {
  15.     while (true)
  16.     {
  17.        
  18.         for (int y = 0; y < maxCord; y++)
  19.         {
  20.             for (int x = 0; x < maxCord; x++)
  21.             {
  22.                 if ((y == loop or y == maxCord - 1 - loop) and (x >= loop and x <= maxCord - 1 - loop))
  23.                 {
  24.                     cout << " * ";
  25.                 }
  26.                 else
  27.                     if ((x == loop or x == maxCord - 1 - loop) and (y >= loop and y <= maxCord - 1 - loop))
  28.                     {
  29.                         cout << " * ";
  30.                     }
  31.                     else
  32.                     {
  33.                         cout << "   ";
  34.                     }
  35.             }
  36.             cout << endl;
  37.         }
  38.  
  39.         if ((loop == maxLoop && loopStep > 0) || (loop == minLoop && loopStep < 0)) { loopStep *= -1; };
  40.         loop += loopStep;
  41.  
  42.         cout << endl;
  43.         std::this_thread::sleep_for(std::chrono::milliseconds(500));
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment