Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <chrono>
- #include <thread>
- int main()
- {
- const int maxLoop = 10;
- const int minLoop = 0;
- int loopStep = -1;
- int loop = 10;
- while (true)
- {
- if ((loop >= maxLoop and loopStep > 0) or (loop <= minLoop and loopStep < 0)) { loopStep *= -1; std::cout << "\n"; };
- std::cout << loop << ' ';
- loop += loopStep;
- std::this_thread::sleep_for(std::chrono::milliseconds(200)); //make some pause for better output look :)
- }
- }
Add Comment
Please, Sign In to add comment