Posts

Showing posts from March, 2019

Write a c program to change the background(setbkcolor()) of the screen

//Write a c program to change the background(setbkcolor()) of the screen  #include<conio.h> #include<stdio.h> #include<graphics.h> void main() {   int gd=DETECT,gm;   int ch;   printf("Choose your color \n1. RED \n2.BLUE\n3. GREEN ");   scanf("%d",&ch);   initgraph(&gd,&gm,"c://Turboc3//bgi");   switch(ch)   { case 2:     setbkcolor(BLUE);     break;     case 3:     setbkcolor(GREEN);     break;     case 1:     setbkcolor(RED);     break;     default: printf("Wrong choice");   }     getch();   closegraph(); }

Write a program to create moving balloons in c programming language

Image
//A c graphics  program to create moving balloons #include<conio.h> #include<stdio.h> #include<graphics.h> #include<dos.h> void main() { int gd=DETECT,gm,i=100; clrscr(); initgraph(&gd,&gm,""); while(!kbhit()) { setfillstyle(SOLID_FILL,RED); setcolor(RED); fillellipse(200,100+i,50,100); line(200,200+i,200,300+i); setfillstyle(4,GREEN); setcolor(GREEN); fillellipse(300,100+i,30,70); line(300,170+i,300,300+i); setfillstyle(SOLID_FILL,YELLOW); setcolor(YELLOW); fillellipse(400,100+i,20,40); line(400,140+i,400,230+i ); setfillstyle(SOLID_FILL,BLUE); setcolor(BLUE); fillellipse(500,100+i,50,90); line(500,190+i,500,300+i); i=i-2;  delay(200); cleardevice(); } getch(); closegraph(); } Output: