0

How can we mimic the progress bar animation using C ?????

https://code.sololearn.com/ckArFTZrN8OO/?ref=app Is there any way . To make the console screen more dynamic✌️✌️✌️✌️🤑.

16th Apr 2020, 9:18 AM
Aditya Narayan Chaurasia
Aditya Narayan Chaurasia - avatar
6 Answers
+ 2
U can use c graphics. if u want to do without graphics then . #inc.... #include<dos.h> void main() { int i; for (i=1; i<=7;i++) { printf("!!"); delay(1000); }
18th Apr 2020, 4:19 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
Instead of doing that on console screen you might think using progress bar in winAPI. https://docs.microsoft.com/en-us/windows/win32/controls/progress-bar-control-reference
16th Apr 2020, 9:50 AM
Mustafa K.
Mustafa K. - avatar
+ 1
Mustafa k. Thanks for your answer.. Bt I am still an intermediate level programmer and haven't used API's. Can we mimic in 'C'?????
16th Apr 2020, 10:18 AM
Aditya Narayan Chaurasia
Aditya Narayan Chaurasia - avatar
+ 1
First have a string for bar and int MAX for the maximum length of string (bar). Add one more character to string every loop, after every print of progress bar delete all the characters with \b (printing "\b" deletes 1 character) then put some break after each print ps: dont know whether that explanation is enough to understand or not but, long story short use "\b"
16th Apr 2020, 2:16 PM
Mustafa K.
Mustafa K. - avatar
+ 1
Mustafa k. Thanks bro. Bt all the calculation of the loop of adding an element or deleting element happens instantly and only final result is printed .. LEAVING NO ANIMATION BUT THE FINAL ANSWER....
16th Apr 2020, 2:32 PM
Aditya Narayan Chaurasia
Aditya Narayan Chaurasia - avatar
+ 1
Yeah, if you use windows, include windows.h and use sleep(int miliSeconds) that can make some delay, (the reason of its happening like in an instant is because current is transmitted on wire with like 95 percent of speed of light)
16th Apr 2020, 2:39 PM
Mustafa K.
Mustafa K. - avatar