Created
February 4, 2024 22:00
-
-
Save wrosecrans/09a8508faead37387ac0d8c49e1aac82 to your computer and use it in GitHub Desktop.
spinny.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <format> | |
#include <thread> | |
int main() { | |
using namespace std::chrono_literals; | |
char spinners[] = {'-','\\','|','/', '-'}; | |
for (int i=0; i<1000; i++) { | |
std::string current_line = std::format("\r{} {} {} {} Hello {} ", | |
spinners[i%4], spinners[(i+1)%4], spinners[(i+2)%4], spinners[(i+3)%4], i%4 ); | |
std::cout << current_line; | |
std::this_thread::sleep_for(500ms); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment