实验一命令解释程序的编写

void main() 

{  int i=0; 

 seefirst(i);

 i=cmd(i);

 if(i==99)  {

 printf("Thank You!bye~\n");

}}

void seefirst(){

 printf("Microsoft Window [版本 6.1.7601]\n");

 printf("版权所有 <c> 2009 Microsoft corporation。");

 printf("保留所有权。\n");

 printf("\n");

 printf("E:\>"); }

int cmd() {

 char ch[N];  int i=0; 

 do{  

 for(i=0;i<N;i++)   {    gets(ch[i]);   

 if((ch[i]<='a')||(ch[i]>='z'))break;

  } 

 if(ch=="dir"){dir();}

  else if(ch=="cd"){cd();}  

else if(ch=="md"){md();} 

 else if(ch=="cls"){cls();} 

 else if(ch=="date"){date();}

 else if(ch=="time"){time();}  

else if(ch=="ren"){ren();}

 else if(ch=="copy"){copy();} 

 else printf("warning!\n"); 

}while(ch=='quit');

 return 99; }

 

posted @ 2016-03-25 15:06  33罗鑫  阅读(150)  评论(0编辑  收藏  举报