⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 learnc.c

📁 一个由c语言编程的一些小游戏
💻 C
字号:
/*作者:跳蚤侦探*/

#include "stdlib.h"
#include "graphics.h"
int i,j;
 begain()/*动画开始函数*/
{
  int a,b,i,color;
  randomize();
  setfillstyle(SOLID_FILL,YELLOW);
  for(i=151;i<=550;i++)/*loding过程*/
  {
  a=rand()%640;
  b=rand()%480;
  color=rand()%13+1;
  putpixel(a,b,color);
  setcolor(11);
  outtextxy(320,235,"loding......");
  bar(i-1,250,i,270);
  delay(700);
  }
  sleep(1);
 cleardevice();
}
 explor()/*画网页的初始界面*/
{setbkcolor(15);
 setfillstyle(SOLID_FILL,BLUE);
 bar(1,1,638,15);
 outtextxy(5,5,"Microsoft Internet Explorer");
 setfillstyle(SOLID_FILL,7);
 bar(1,15,638,40);
 setfillstyle(SOLID_FILL,15);
 bar(2,20,400,35);
 setcolor(4);
 outtextxy(5,23,"http://");
}
mousemove(int i,int j)/*网页下画鼠标*/
{ line(i,j,i+5,j+10);
 line(i,j,i-5,j+10);
 line(i-5,j+10,i-2,j+10);
 line(i+5,j+10,i+2,j+10);
 line(i-2,j+10,i-2,j+20);
 line(i+2,j+10,i+2,j+20);
 line(i-2,j+20,i+2,j+20);
}
mousemoveto()/*网页中的鼠标具体移动*/
{
 for(i=400,j=300;j>=20;)
 {
 setcolor(5);
 mousemove(i,j);
 if(j==300)
 sleep(1);
 if(j<=70)/*临时变相的速度改变*/
 delay(700);
 delay(600);
 if(j==20)
 delay(7000);
 setcolor(15);
 mousemove(i,j);
 setfillstyle(SOLID_FILL,7);
 bar(1,35,638,40);
 if(j<=70)/*临时变向*/
 i--,i--,j--;
 else
 i--,j--;
 }
}
explorword()/*鼠标移动结束后显示网站地址*/
{setcolor(RED);
 outtextxy(60,23,"w");
 delay(3000);
 outtextxy(70,23,"w");
 delay(3000);
 outtextxy(80,23,"w");
 delay(3000);
 outtextxy(90,23,".");
 delay(3000);
 outtextxy(100,23,"v");
 delay(3000);
 outtextxy(110,23,"c");
 delay(3000);
 outtextxy(120,23,"o");
 delay(3000);
 outtextxy(130,23,"k");
 delay(3000);
 outtextxy(140,23,".");
 delay(3000);
 outtextxy(150,23,"c");
 delay(3000);
 outtextxy(160,23,"o");
 delay(3000);
 outtextxy(170,23,"m");
 sleep(1);
}
 classroom1()/*c与语言教室初始化*/
{
 cleardevice();
 setbkcolor(15);
 setfillstyle(SOLID_FILL,9);
 bar(0,1,640,6);
 bar(0,80,640,85);
 bar(200,15,440,70);
 setcolor(11);
 outtextxy(270,40,"www.vcok.com");
 setfillstyle(SOLID_FILL,7);
 bar(0,100,640,120);
 setcolor(10);
 outtextxy(10,105,"c class room");
 setfillstyle(SOLID_FILL,9);
 bar(0,130,640,145);
 setcolor(15);
 outtextxy(10,135,"there are 20 people ");
 setcolor(9);
 for(i=170;i<=460;i+=20)
 line(50,i,580,i);
 line(50,170,50,450);
 line(580,170,580,450);
 line(100,170,100,450);
 line(500,170,500,450);
 setcolor(10);
 outtextxy(10,460,"1th page");
 setfillstyle(SOLID_FILL,RED);
 for(i=175;i<=450;i+=20)
 {
 if(i>215)
 setfillstyle(SOLID_FILL,9);
 bar(65,i,85,i+10);
 }
}
 ask()/*在c语言教室问问题得到答复*/
{
cleardevice();
setcolor(15);
setfillstyle(SOLID_FILL,9);
bar(1,2,640,20);
outtextxy(10,7,"c classroom");
setcolor(9);
for(i=50;i<=400;i+=100)
rectangle(100,i,500,i+80);
setcolor(4);
outtextxy(110,60,"Who can tell me the answer of x=1 y=3 y+=50+x?");
outtextxy(400,80,"milo_zy");
sleep(2);
outtextxy(110,160,"(y+=50+x)=(y=y+50+x) Do you know?");
outtextxy(400,180,"aa98");
sleep(2);
outtextxy(110,260,"y=3+50+1=54.");
outtextxy(400,280,"feiyun");
sleep(2);
outtextxy(110,360,"Thank you! ^_^");
outtextxy(400,380,"milo_zy");
sleep(2);
}
classmouse()/*鼠标字c教室的移动*/
{
for(j=440;j>=235;j--)
 {
 setcolor(4);
 mousemove(600,j);
 if(j==440)
 sleep(1);
 delay(750);
 setcolor(15);
 mousemove(600,j);
 }
for(i=600;i>=280;i--)
 {
 setcolor(4);
 mousemove(i,230);
 if(i==280)
 sleep(1);
 delay(750);
 setcolor(15);
 mousemove(i,230);
 setcolor(9);
 line(500,230,500,255);
 line(580,230,580,255);
 line(50,230,580,230);
 line(50,250,580,250);
 setcolor(RED);
 outtextxy(510,235,"milo_zy");
 outtextxy(250,235,"H E L P");
 }
}
 classroom2()/*c语言教室具体内容*/
{
 classroom1();/*调用初始化*/
 for(i=175;i<=450;i+=20)
 {
 setcolor(9);
 if(i==235)
  {
  setcolor(RED);
  outtextxy(250,i,"H E L P");
  outtextxy(510,i,"milo_zy");
  }
 else
  {
  outtextxy(250,i,"X X X X");
  outtextxy(510,i,"X X X X");
  }
 }
 classmouse();
}
 end()/*动画结束函数*/
{
int color;
cleardevice();
setbkcolor(0);
sleep(1);
setwritemode(XOR_PUT);
randomize();
settextstyle(3,0,1);
setusercharsize(3,1,2,1);
j=0;
for(i=5;;)
 {
 color=rand()%12+1;
 setcolor(color);
 outtextxy(1,i,"www.vcok.com");
 if(j==2&&i>200)
 {
 sleep(2);
 break;
 }
 delay(800);
 setcolor(0);
 outtextxy(1,i,"www.vcok.com");
 if(j==0)
 i+=3;
 else if(j==1)
 i-=3;
 else if(j==2)
 i+=3;
 if(i>420)
 j=1;
 if(i<4)
 j=2;
 }
}
 main()
{int gd=DETECT,gr;
 initgraph(&gd,&gr,"");
 begain();/*动画开始函数*/
 explor();/*网页初始函数*/
 mousemoveto();/*鼠标移动过程*/
 explorword();/*显示网站地址*/
 classroom2();/*c语言教室过程*/
 ask();/*问问题*/
 end();/*动画结束*/
 getch();
 closegraph();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -