| 网站首页 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛 |
 
| 技术教程首页 | 开发语言 | WEB开发 | .NET技术 | 数据库 | 操作系统 | 网页制作 |
 
 
您现在的位置: 编程中国 >> 技术教程 >> 开发语言 >> C语言 >> C技术资料 >> 正文
  ►  文章练字程序
文章练字程序
作者:小骚    阅读人次:……    文章来源:cstudyhome.com    发布时间:2004-10-2    网友评论()条
 

#include<dos.h>
#include<stdio.h>
#include<conio.h>
 xfk()
 {
 char *zq=" ture",*cu="flase",*fs="score";
 int i,j,hh=7;
 textcolor(YELLOW);
 gotoxy(3,6);
 cputs(zq);
 gotoxy(3,11);
 cputs(cu);
 gotoxy(3,16);
 cputs(fs);
 textcolor(GREEN);
 for(i=1;i<=3;i++)
  {
   gotoxy(3,hh);
   putch('\311');
   for(j=4;j<=7;j++)
    {
    gotoxy(j,hh);
    putch('\315');
    }
   gotoxy(8,hh);
   putch('\273');
   hh=hh+5;
  }
 hh=8;
 for(i=1;i<=3;i++)
  {
   gotoxy(3,hh);
   putch('\272');
   gotoxy(8,hh);
   putch('\272');
   hh=hh+5;
   }
 hh=9;
 for(i=1;i<=3;i++)
  {
   gotoxy(3,hh);
   putch('\310');
   for(j=4;j<=8;j++)
   {
    gotoxy(j,hh);
    putch('\315');
   }
   gotoxy(8,hh);
   putch('\274');
   hh=hh+5;
  }
textcolor(GREEN);
}

 


 wcbk()
 {
  int thh,tlh;
  textcolor(WHITE);
  thh=1;
  tlh=1;
  gotoxy(tlh,thh);
  putch('\332');
  for(tlh=2;tlh<=78;tlh++)
     {
      gotoxy(tlh,thh);
      putch('\304');
     }
  gotoxy(tlh,thh);
  putch('\277');
  tlh=1;
  for(thh=2;thh<=25;thh++)
    {
     gotoxy(tlh,thh);
     putch('\263');
     gotoxy(tlh+78,thh);
     putch('\263');
    }
  thh=25;
  gotoxy(tlh,thh);
  putch('\300');
  for(tlh=2;tlh<=78;tlh++)
    {
     gotoxy(tlh,thh);
     putch('\304');
    }
  gotoxy(tlh,thh);
  putch('\276');
  textcolor(GREEN);
 }
 lcbk()
 {
  int thh,tlh;
  textcolor(YELLOW);
  thh=3;
  tlh=10;
  gotoxy(tlh,thh);
  putch('\311');
  for(tlh=11;tlh<=70;tlh++)
     {
      gotoxy(tlh,thh);
      putch('\315');
     }
  gotoxy(tlh,thh);
  putch('\273');
  tlh=10;
  for(thh=4;thh<=22;thh++)
    {
     gotoxy(tlh,thh);
     putch('\272');
     gotoxy(tlh+61,thh);
     putch('\272');
    }
  thh=23;
  gotoxy(tlh,thh);
  putch('\310');
  for(tlh=11;tlh<=70;tlh++)
    {
     gotoxy(tlh,thh);
     putch('\315');
    }
  gotoxy(tlh,thh);
  putch('\274');
  textcolor(GREEN);
  }
 zhhs(char lfilename[20])
{
 int hh=5,lh=13,i,wz=0,cj=4,bj=1,thh,tlh,zq=0,cu=0,fs=0;
 char *zh,lsslzh,filezh;
 FILE *fp;
 if(!(fp=fopen(lfilename,"r")))
 {printf("cannot open file\n");exit(1);}

 while(1)
  {
   wcbk();
   lcbk();
   xfk();
   for(i=1;i<=6;i++)
    {
     fread(zh,50,1,fp);
     gotoxy(lh,hh);
     cputs(zh);
     hh=hh+3;
     if(feof(fp)) break;
    }
  fseek(fp,wz,0);
  for(hh=6;hh<=21;hh=hh+3)
    {
    for(lh=13;lh<=62;lh++)
      {
       bj=1;
      
       gotoxy(lh,hh);
       putch(24);
       gotoxy(lh,hh);
       filezh=fgetc(fp);
    
       wz=wz+1;
      
       if((lsslzh=getch())==27) exit(1);
       if((lsslzh==8)&&!(hh==6&&lh==13))
         {
        
  bj=0;

  if((lh==13)&&(hh!=6))
   {
           putch(' ');
           lh=62;
    hh=hh-3;
    cj=cj-3;
    }
         else lh=lh-1;
  wz=wz-2;
         gotoxy(lh,hh);
         putch(' ');
         gotoxy(lh,cj);
         putch(' ');
  gotoxy(lh+1,hh);
  putch(' ');
  lh=lh-1;
         fseek(fp,wz,0);
         }
       gotoxy(lh,hh);
       if(filezh==EOF) return(lsslzh);
       if(filezh==lsslzh)
       {
       putch(lsslzh);
       fs=fs+5;
       zq=zq+1;
       gotoxy(4,8);
       printf("%2d",zq);
       gotoxy(4,18);
       printf("%2d",fs);
       }
       else
 {
  if(bj)
  {
  cu=cu+1;
  gotoxy(4,13);
  printf("%2d",cu);
  gotoxy(lh,hh);
         textcolor(RED);
         putch(lsslzh);
         gotoxy(lh,cj);
         putch(25);
         gotoxy(lh,hh);
         sound(980);
         delay(100000);
         nosound();
         textcolor(GREEN);  
          }
  }
       }

       cj=cj+3;
     }
 delay(2000);
 textcolor(YELLOW);
 clrscr();

 wz=ftell(fp);
 hh=5;
 lh=13;
 cj=4;
 }
}
main()
{
int thh=3,tlh=10;
char zh;
char *filename, *lesson="1.College Life\n2.study Online\n3.Lesiure Activity\n4.Living on your own";
window(1,1,20,40);
textbackground(BLUE);
textcolor(YELLOW);

while(1)
  {

  clrscr();
  printf("%s\n",lesson);
  printf("choice lesson number:");
  zh=getch();
  switch(zh)
   {
    case 49: filename="e:\\fcp\\college.txt";break;
    case 50:  filename="e:\\fcp\\study.txt";break;
    case 51:  filename="e:\\fcp\\lesiure.txt";break;
    case 52:  filename="e:\\fcp\\living.txt";break;
    case 27: exit(1);
    default: printf("enter file name:");scanf("%s",filename);
   }
  clrscr();
  zhhs(filename);
  clrscr();
  printf("continue   practic(y\n):");
  if(getch()=='n') break;
}
}

 

 
文章录入:静夜思    责任编辑:静夜思 
  • 上一篇文章:

  • 下一篇文章:

  •  
    相关文章
    没有相关文章
    原创地带
    24小时热门帖子