C Graphics Program to Draw a Hot Air Balloon on Command Line

Using this tutorial, We are going to discuss the concept to learn “C Graphics Program to Draw a Hot Air Balloon on Command Line”. Shall we start the discussion below? Let’s go.

C Graphics Program to Draw a Hot Air Balloon on Command Line

C Graphics Program to Draw a Hot Air Balloon on Command Line

Source Code

// C program to design a Hot Air Balloon
// using graphics
#include <conio.h>
#include <graphics.h>
#include <stdio.h>

// Driver Code
void main()
{
	int gd = DETECT, gm;

	// Initialize of gdriver with
	// DETECT macros
	initgraph(&gd, &gm, "C:\"
						"turboc3\bgi");

	// Set the Background Color to blue
	setfillstyle(SOLID_FILL, BLUE);
	floodfill(100, 100, 15);

	// Set Circle Balloon Color
	// With Red
	setfillstyle(SOLID_FILL, RED);

	// Creating Balloon
	circle(550, 200, 100);
	floodfill(552, 202, 15);

	// Set The Rope Color
	// With White
	setfillstyle(SOLID_FILL, WHITE);

	// Right Side Right Rope
	line(650, 200, 630, 400);

	// Right Side Left Rope
	line(650, 200, 620, 400);

	// Connect the two right side ropes
	// for coloring purpose
	line(620, 400, 630, 400);
	floodfill(625, 398, 15);

	// Left side left rope
	line(450, 200, 470, 400);

	// Left side right rope

	line(450, 200, 480, 400);

	// Connect the two left side ropes
	// for coloring purpose
	line(470, 400, 480, 400);
	floodfill(475, 398, 15);

	// Set Container One Part
	// With Brown
	setfillstyle(SOLID_FILL, BROWN);
	rectangle(450, 400, 650, 500);
	floodfill(452, 402, 15);

	// Set Container Another
	// Part With Yellow
	setfillstyle(XHATCH_FILL, YELLOW);

	// Dividing Container For
	// Decorating Purpose
	line(450, 430, 650, 430);
	floodfill(452, 498, 15);

	// Hold the screen
	getch();

	// Close the initialized gdriver
	closegraph();
}

Final Words

I hope this article helps you to know about “C Graphics Program to Draw a Hot Air Balloon on Command Line”. If you face any issues please let me know via the comment section. Share this article with other C/C++ developers via social networks.

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