Graphic interface application in C language

Source: Internet
Author: User
Tags exit include printf

#include <conio.h>
#include <stdlib.h>
#include "stdio.h"
#include "Graphics.h"
#include "math.h"
Donghua ()
{int GRAPHDRIVER=VGA;
int Graphmode=vgahi;
int i,j;
Initgraph (&graphdriver,&graphmode, "");
Cleardevice ();
/************wan Nian li*************************/
for (i=0;i<=150;i+=5)
{SetColor (i);
Textbackground (RED);
Settextstyle (0,0,5);
Outtextxy (100,i+140, "Wan Nian Li");
Delay (10000000);
Cleardevice ();
}
SetColor (RED);
Outtextxy (50,200, "Loading");
Delay (100000000000);
Outtextxy (50,200, "Loading.");
Delay (100000000000);
Outtextxy (50,200, "Loading ...");
Delay (100000000000);
Outtextxy (50,200, "Loading ...");
Delay (100000000000);
Outtextxy (50,200, "Loading ...");
Delay (100000000000);
Outtextxy (50,200, "Loading ...");
Delay (100000000000);
Outtextxy (50,200, "Loading ...");
Delay (100000000000);
Outtextxy (50,200, "Loading ...");
Delay (100000000000);
Outtextxy (50,200, "Loading ...");
Delay (100000000000);
Outtextxy (50,200, "Loading ...");
Delay (100000000000);
Outtextxy (50,200, "Loading ... ...");
Delay (100000000000);
Outtextxy (50,200, "Loading ... ...");
Outtextxy (50,200, "Loading ... ..."); "
Delay (100000000000);
for (i=0;i<=10;i++)
Delay (100000000000);
Cleardevice ();
/*********************printf color*************************/
for (i=0;i<=15;i++)/*15 color of kind*/
{
SetBkColor (i+1);
SetColor (i);
Setfillstyle (1,i+1);
for (j=0;j<=600;j++)
{delay (1000);
Circle (320,240,J);
FloodFill (320,240,i);
}
}
}
/*************menu**********************/
void menu ()
{int i,j;
Cleardevice ();
SetBkColor (GREEN);
for (i=0;i<=100;i++)
{delay (1000);
for (j=0;j<=10;j++)
{Setfillstyle (1,lightgreen);
SetColor (BROWN);
Circle (320,240,i);
FloodFill (320,240,brown);}
}
for (i=0;i<=70;i++)
{delay (1000);
for (j=0;j<=20;j++)
{Setfillstyle (1,red);
SetColor (RED);
Circle (220,100,i);
FloodFill (220,100,red);}
}
SetColor (yellow);
Settextstyle (3,0,5);
Outtextxy (190,75, "Run");
for (i=0;i<=70;i++)
{delay (1000);
for (j=0;j<=20;j++)
{Setfillstyle (1,blue);
SetColor (BLUE);
Circle (420,100,i);
FloodFill (420,100,blue);}
}
SetColor (RED);
Settextstyle (3,0,5);
Outtextxy (375,75, "Game");
for (i=0;i<=70;i++)
{delay (1000);
for (j=0;j<=20;j++)
{Setfillstyle (1,lightblue);
SetColor (LightBlue);
Circle (220,380,i);
FloodFill (220,380,lightblue);}
}
SetColor (RED);
Settextstyle (3,0,5);
Outtextxy (165,360, "Me");

for (i=0;i<=70;i++)
{delay (1000);
for (j=0;j<=20;j++)
{Setfillstyle (1,lightred);
SetColor (lightred);
Circle (420,380,i);
FloodFill (420,380,lightred);}
}
SetColor (yellow);
Settextstyle (3,0,5);
Outtextxy (390,360, "Exit");
SetColor (BLUE);
Settextstyle (3,0,6);
Delay (1500000);
Outtextxy (280,210, "help");
/***********draw line*******************/
for (i=130;i<=500;i++)
{for (j=0;j<=100;j++)
Delay (10);
SetColor (BLUE);
Line (130,20,i,20);
Delay (10);
Line (128,18,i+2,18);
}
for (i=20;i<=460;i++)
{for (j=0;j<=100;j++)
Delay (10);
SetColor (BLUE);
Line (500,20,500,i);
Delay (10);
Line (502,18,502,i+2);
}
for (i=500;i>=130;i--)
{for (j=100;j>=0;j--)
Delay (10);
SetColor (BLUE);
Line (500,460,i,460);
Delay (10);
Line (502,462,i-2,462);
}
for (i=460;i>=20;i--)
{for (j=100;j>=0;j--)
Delay (10);
SetColor (BLUE);
Line (130,460,130,i);
Delay (10);
Line (128,462,128,i-2);
}
/*************wan Nian li*****************************/
SetColor (RED);
Settextstyle (0,0,4);
for (j=15;j>=0;j-=2)
{delay (1000000);
Outtextxy (j+10,j+50, "Wan");
}
for (j=15;j>=0;j-=2)
{delay (1000000);
Outtextxy (j,j+200, "Nian");
}
for (j=15;j>=0;j-=2)
{delay (1000000);
Outtextxy (j+10,j+350, "Li");
}
Getch ();
}
/**************************************/
Bofangdonghua ()
{int GRAPHDRIVER=VGA;
int Graphmode=vgahi;
int i,j;
char c;
Initgraph (&graphdriver,&graphmode, "");
/*************shi fou Bo Fang Dong hua?**************/
Printf:{setcolor (RED);
Settextstyle (3,0,5);
Outtextxy (100,30, "Bo Fang Dong Hua");
Outtextxy (150,80, "Yes");
Outtextxy (300,80, "No");
C=getch ();
if (c== ' Y ') | | c== ' y ')
{Donghua ();
menu ();
}
Else
if (c== ' N ' | | c== ' n ')
menu ();
Else
{SetColor (GREEN);
Settextstyle (3,0,8);
Outtextxy (200,240, "error!");
Delay (10000000000);
Cleardevice ();
Goto printf;
}
}
/**************************************/

}
Main ()
{int GRAPHDRIVER=VGA;
int Graphmode=vgahi;
char c;
Initgraph (&graphdriver,&graphmode, "");
Bofangdonghua ();
C=getch ();
while (c!= ' e ' &&c!= ' e ')
{if (c== ' r ') | | c== ' R ')
Run ();
else if (c== ' G ' | | c== ' G ')
Game ();
else if (c== ' m ' | | c== ' M ')
About ();
else if (c== ' H ' | | c== ' h ')
Help ();
else {
Settextstyle (3,1,6);
Delay (10000000000);
Outtextxy (530,240, "error!");
}
C=getch (); }
End ();}
Game ()
{Cleardevice ();
SetBkColor (black);
SetColor (RED);
Settextstyle (3,0,5);
Bar3d (10,10,600,500,2,1);
Outtextxy (100,210, "Sorry,it ' s mading!!");
SetColor (white);
Settextstyle (3,0,3);
Outtextxy (300,450, "Press any key to menu!!");
Getch ();
Jingzhimenu ();
}
Run ()
{int GRAPHDRIVER=VGA;
int Graphmode=vgahi;
int i;
int day;
int year;
int temp;
int temp_i;
long int year_days = 0;
int year_start = 1;
int per_year_days;
int month_day[]={31,28,31,30,31,30,31,31,30,31,30,31,29};
Initgraph (&graphdriver,&graphmode, "");
Cleardevice ();
SetBkColor (black);
printf ("Please enter the Year:");
scanf ("%d", &year);

while (Year_start < year)
{
if (Isleapyear (Year_start))
Per_year_days = 366;
Else
Per_year_days = 365;

Year_days = Year_days + per_year_days;
year_start++;
}

for (temp = 1; temp <=12; temp++)
{
Switch (temp)
{
Case 1:
printf ("January (%d) \ n", year);
Break
Case 2:
printf ("February (%d) \ n", year);
Break
Case 3:
printf ("March (%d) \ n", year);
Break
Case 4:
printf ("April (%d) \ n", year);
Break
Case 5:
printf ("may (%d) \ n", year);
Break
Case 6:
printf ("June (%d) \ n", year);
Break
Case 7:
printf ("July (%d) \ n", year);
Break
Case 8:
printf ("August (%d) \ n", year);
Break
Case 9:
printf ("September (%d) \ n", year);
Break
Case 10:
printf ("October (%d) \ n", year);
Break
Case 11:
printf ("November (%d) \ n", year);
Break
Case 12:
printf ("December (%d) \ n", year);
Break
}
i = year_days% 7;
printf ("Sun Mon Tue Wed Thu Fri Sat \ n");
if (i!= 0)
for (temp_i = 0; temp_i < i; temp_i++)
printf ("");
Day = 1;
if (Isleapyear (year) && temp = 2)
while (day <= month_day[12])
{
if (Day >1)
if (year_days% 7 = 0)
printf ("\ n");
if (Day >= 10)
printf ("%d", day);
Else
printf ("%d", day);
year_days++;
day++;
}

Else
while (day <= month_day[temp-1])
{
if (Day > 1)
if (year_days% 7 = 0)
printf ("\ n");
if (Day >=10)
printf ("%d", day);
Else
printf ("%d", day);
year_days++;
day++;
}
printf ("\ n");
if (getch () = = ' Q ')
Exit (0);
}
Getch ();
Jingzhimenu ();
}


int isleapyear (int year)
{
if (year%4 = 0) && (year% 100!= 0) | |
(Year% 400 = 0))
return 1;
Else
return 0;

}
Help ()
{int gdriver=detect,gmode,i,n;
float t,x[6],y[6],a[5],b[5];
Initgraph (&gdriver,&gmode, "C:\\TC");
Cleardevice ();
Hua ();
SetBkColor (BLUE);
SetColor (yellow);
Settextstyle (3,0,3);
Outtextxy (100,200, "Press ' R ' or ' R '----Run");
Outtextxy (100,300, "Press ' g ' or ' G '-----Game");
Outtextxy (100,400, "Press ' m ' or ' m-----About Me");
Outtextxy (100,480, "press ' e ' or ' e '----exit");
SetColor (RED);
Outtextxy (100,100, "Press any key to menu!!");
Getch ();
Jingzhimenu ();
}
HUA2 (int x,int y)
{int GRAPHDRIVER=VGA;
int Graphmode=vgahi;
Register I;
Initgraph (&graphdriver,&graphmode, "");
SetColor (12);
Arc (x+65,y-60,150,350,8);
Arc (x+66,y-54,300,470,8);
Arc (x+65,y-56,30,230,10);
Arc (x+64,y-57,300,460,17);
Ellipse (x+73,y-30,250,450,27,40);
Ellipse (x+59,y-30,100,290,27,40);
Ellipse (x+65,y-40,140,270,20,30);
Setfillstyle (solid_fill,5);
FloodFill (x+65,y-20,12);
Arc (x,y,150,350,12);
Arc (x+1,y+8,280,470,12);
Arc (x,y+2,30,230,16);
Arc (x,y+3,80,240,28);
Arc (x+2,y+8,180,330,22);
Arc (x-2,y+2,310,460,25);
Ellipse (x-12,y+30,120,300,30,40);
Ellipse (x+10,y+28,250,423,30,42);
Ellipse (x-4,y+10,290,393,30,40);
Setfillstyle (solid_fill,4);
FloodFill (x+5,y+31,12);
Ellipse (x+120,y+5,0,360,15,25);
Setfillstyle (solid_fill,15);
FloodFill (x+120,y,12);
Ellipse (x-70,y+10,0,360,14,20);
Setfillstyle (solid_fill,14);
FloodFill (x-70,y+10,12);
SetColor (10);
Ellipse (x-15,y+32,190,310,30,35);
Ellipse (x+16,y+32,235,355,26,35);
Ellipse (x,y+35,190,350,43,50);
Arc (x,y+82,190,350,6);
Setfillstyle (solid_fill,2);
FloodFill (x,y+75,10);
Ellipse (x+50,y-48,190,320,22,50);
Ellipse (x+80,y-48,220,350,22,50);
Ellipse (x+65,y-28,180,360,36,50);
FloodFill (x+65,y+18,10);
for (i=0;i<3;i++)
{
Ellipse (x-98,y+100+i,255,371,100,80);
Ellipse (x-20,y+30+i,260,358,140,140);
Ellipse (x+233,y+20+i,180,218,160,140);
}
Ellipse (x+70,y+34,180,233,140,140);
Ellipse (x,y+40,205,255,100,120);
Ellipse (x+135,y-30,209,249,72,120);
Ellipse (x,y+20,263,301,100,120);
Ellipse (x+85,y-10,278,305,100,120);
Ellipse (x+100,y-62,282,308,90,120);
Ellipse (x-50,y-10,277,314,30,120);
Ellipse (x+70,y+80,222,266,52,120);
Ellipse (x-60,y-45,229,266,52,120);
Ellipse (x+79,y-45,229,266,52,120);
Ellipse (x+84,y,224,273,52,120);
Ellipse (x+110,y+40,240,282,100,120);
Ellipse (x+120,y-6,200,340,17,25);
Ellipse (x+120,y+7,160,380,17,27);
Ellipse (x-70,y+15,140,380,17,20);
}
Hua ()
{int GRAPHDRIVER=VGA;
int Graphmode=vgahi;
Initgraph (&graphdriver,&graphmode, "");
Cleardevice ();
HUA2 (480,90);
SetColor (10);
Rectangle (0,0,639,479);
}
About ()
{Cleardevice ();
SetBkColor (BLUE);
SetColor (GREEN);
Settextstyle (3,0,3);
Outtextxy (10,100, "My 中文版 name is Kemble");
Outtextxy (10,150, "my homepage http://www.kemble0673.533.net");
Outtextxy (10,200, "Glad to meet you!!");
Outtextxy (300,400, "Press any key to menu!");
Getch ();
Jingzhimenu ();
}
End ()
{int i;
for (i=0;i<=15;i++)
{Cleardevice ();
SetColor (i);
SetColor (i);
Settextstyle (3,0,i-5);
Outtextxy (20,200, "Happy evrey day!!");
Delay (10000000000);
}

Outtextxy (100,200, "Bye ...");
Cleardevice ();
for (i=0;i<=25;i++)
Delay (1000000000000);
Outtextxy (100,200, "Bye ...");
Closegraph ();}

Jingzhimenu ()
{int GRAPHDRIVER=VGA;
int Graphmode=vgahi;
Initgraph (&graphdriver,&graphmode, "");
Cleardevice ();
SetBkColor (GREEN);
Setfillstyle (1,lightgreen);
SetColor (BROWN);
Circle (320,240,100);
FloodFill (320,240,brown);
Setfillstyle (1,red);
SetColor (RED);
Circle (220,100,70);
FloodFill (220,100,red);
SetColor (yellow);
Settextstyle (3,0,5);
Outtextxy (190,75, "Run");
Setfillstyle (1,blue);
SetColor (BLUE);
Circle (420,100,70);
FloodFill (420,100,blue);

SetColor (RED);
Settextstyle (3,0,5);
Outtextxy (375,75, "Game");
Setfillstyle (1,lightblue);
SetColor (LightBlue);
Circle (220,380,70);
FloodFill (220,380,lightblue);
SetColor (RED);
Settextstyle (3,0,5);
Outtextxy (165,360, "Me");
Setfillstyle (1,lightred);
SetColor (lightred);
Circle (420,380,70);
FloodFill (420,380,lightred);
SetColor (yellow);
Settextstyle (3,0,5);
Outtextxy (390,360, "Exit");
SetColor (BLUE);
Settextstyle (3,0,6);
Outtextxy (280,210, "help");
Line (130,20,500,20);
Delay (10);
Line (128,18,502,18);
Line (500,20,500,460);
Delay (10);
Line (502,18,502,462);
Line (500,460,130,460);
Delay (10);
Line (502,462,128,462);
Line (130,460,130,20);
Delay (10);
Line (128,462,128,18);
SetColor (RED);
Settextstyle (3,0,6);
Outtextxy (10,50, "wan");
Outtextxy (10,240, "Nian");
Outtextxy (50,380, "Li");
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.