计算机等级 百分网手机站

计算机二级考试c语言过关经验(2)

时间:2018-02-12 14:30:21 计算机等级 我要投稿

计算机二级考试c语言过关经验

  /* install the graphic device.the third parameter is the path of the driver*/

  setbkcolor(0);

  setcolor(WHITE);

  while(1)

  {

  circle(x,y,r);/*paintthecircle*/

  line(x,y+r-10,x,y+r-12);

  line(x+r-4,y,x+r,y);

  line(x-r,y,x-r+4,y);

  line(x,y-r+10,x,y-r+10+2); /* draw the fout scales */

  gettime(&t);

  sprintf(s,"The current time is %2d:%02d:%02d\n",t.ti_hour,t.ti_min,t.ti_sec,t);

  outtextxy(0,0,s); /* out put the current time */

  outtextxy(0,10,"This clock is written by lijun"); /*?show the auther */

  coss=(int)((r-10)*cos(t.ti_sec*3.14f/30-3.14f/2)+x);

  sins=(int)((r-10)*sin(t.ti_sec*3.14f/30-3.14f/2)+y);

  cosm=(int)((r-19)*cos(t.ti_min*3.14f/30-3.14f/2)+x);

  sinm=(int)((r-19)*sin(t.ti_min*3.14f/30-3.14f/2)+y);

  cosh=(int)((r-28)*cos((t.ti_hour+(float)(t.ti_min)/60)*3.14f/6-3.14f/2)+x);

  sinh=(int)((r-28)*sin((t.ti_hour+(float)(t.ti_min)/60)*3.14f/6-3.14f/2)+y);

  /* calculate the position of the three points */

  setcolor(14);

  line(x,y,coss,sins);

  setcolor(13);

  line(x,y,cosm,sinm);

  setcolor(10);

  line(x,y,cosh,sinh);

  setcolor(15);

  /* draw the points */

  sleep(1);

  clrscr();&nb

  sp;

  keydown=kbhit();/* check whether key down */

  if(keydown)

  {

  closegraph();/* close graphic device */

  exit(0);

  }

  }

  }

【计算机二级考试c语言过关经验】相关文章:

1.计算机等级二级C语言考试经验

2.计算机二级C语言资料

3.计算机二级C语言真题及答案

4.计算机二级c语言试题及答案

5.2017计算机二级考试内容C语言

6.计算机二级C语言考试试题及答案

7.2017年计算机C语言二级考试试题

8.计算机二级考试C语言知识点