Hi, i've been wondering how some program using codes is animated?
How to add animation to a program or code?
Collapse
X
-
-
You can use characters if you want, like *. For example:
These strings are displayed on top of each other with a 1/2 pause between display. The effect is to see the * travel across the screen:
Code:#include <windows.h> ostream& pause(ostream& os) { Sleep(500); return os; } int main() { char* str1 = "* "; char* str2 = " * "; char* str3 = " * "; char* str4 = " * "; char* str5 = " * "; cout << str1 <<pause << "\r" << str2 <<pause << "\r" << str3<<pause << "\r" << str4 <<pause << "\r" << str5 <<pause << endl; }Comment
Comment