Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <chrono>
- #include <thread>
- char block = '#';
- const int maxCord = 10;
- const int maxLoop = maxCord-1 ;
- const int minLoop = 0;
- int loopStep = 1;
- int loop = minLoop;
- using namespace std;
- int main()
- {
- while (true)
- {
- for (int y = 0; y < maxCord; y++)
- {
- for (int x = 0; x < maxCord; x++)
- {
- block = ' ';
- if (x == loop) { block = '*'; };
- if (y == loop) { block = '*'; };
- cout << ' ' << block << ' ';
- }
- cout << endl;
- }
- if ((loop == maxLoop && loopStep > 0) || (loop == minLoop && loopStep < 0)) { loopStep *= -1; };
- loop += loopStep;
- cout << endl;
- std::this_thread::sleep_for(std::chrono::milliseconds(500));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment