Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <chrono>
- #include <thread>
- const int maxCord = 10;
- const int maxLoop = maxCord / 2 ;
- 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++)
- {
- if ((y == loop or y == maxCord - 1 - loop) and (x >= loop and x <= maxCord - 1 - loop))
- {
- cout << " * ";
- }
- else
- if ((x == loop or x == maxCord - 1 - loop) and (y >= loop and y <= maxCord - 1 - loop))
- {
- cout << " * ";
- }
- else
- {
- cout << " ";
- }
- }
- 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