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âď¸âď¸âď¸âď¸đ¤.
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);
}
+ 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
+ 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'?????
+ 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"
+ 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....
+ 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)