C Graphics Program to Draw or Simulate Colorful Loading Progressbar Animation on Command Line

In this article, I’m going to share the details about “C Graphics Program to Draw or Simulate Colorful Loading Progressbar Animation on Command Line“. Let’s try to do the task using this article below.

C Graphics Program to Draw or Simulate Colorful Loading Progressbar Animation on Command Line

C Graphics Program to Draw or Simulate Colorful Loading Progressbar Animation on Command Line

Program Code

// C program to create loading bar
#include <stdio.h>
#include <windows.h>

// Function to creating loading bar
void loadingBar()
{
	// 0 - black background,
	// A - Green Foreground
	system("color 0A");

	// Initialize char for printing
	// loading bar
	char a = 177, b = 219;

	printf("nnnn");
	printf("nnnnttttt"
		+ "Loading...nn");
	printf("ttttt");

	// Print initial loading bar
	for (int i = 0; i < 26; i++)
		printf("%c", a);

	// Set the cursor again starting
	// point of loading bar
	printf("r");
	printf("ttttt");

	// Print loading bar progress
	for (int i = 0; i < 26; i++) {
		printf("%c", b);

		// Sleep for 1 second
		Sleep(1000);
	}
}

// Driver Code
int main()
{
	// Function Call
	loadingBar();
	return 0;
}

Final Words

I hope this article helps you to learn C Graphics Program to Draw or Simulate Colorful Loading Progressbar Animation on Command Line . To get more useful updates, don’t forget to bookmark us. Share this article with other C/C++ developers to help them.

Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment