zoukankan      html  css  js  c++  java
  • 实验一总结

     1 #include<stdio.h>
     2 #include<string.h>
     3 void main() /*主函数*/
     4 {
     5 char *b[11]={"dir","cd","md","rd","cls","date","time","ren","copy","help", "quit"}; /*指针数组存储关键字*/
     6 int pan(char ch1[],char *j[11]);
     7 char a[10],*p=a;
     8 printf("Welcome.........
    Pleas enter a command!
    Enter 'quit' to quit.
    For help,Enter 'help'.
    ");
     9 c1: printf("c:>$");
    10 scanf("%s",a);
    11 pan(p,b); /*函数调用*/
    12 if(strcmp(a,b[10])!=0) /*比较输入的字符串是否quit结束命令*/ goto c1;
    13 else printf("out of work!!
    ");
    14 }
    15 int pan(char ch1[],char *j[11]) /*子函数*/
    16 {
    17 int i;
    18 for( i=0;i<11;i++)
    19 if(strcmp(ch1,j[i])==0) /*比较输入的字符串与数组的关键字是否相等*/
    20 {
    21 switch(i)
    22 {
    23 case 0:printf("command name is dir.
    It's function is list file.
    It's an internal command.
    Volume in drive K gas no label.
    Volume Serial Number is 60F0-6C24
    
    ");break;
    24 case 1:printf("command name is cd.
    It's function is change directory.
    It's an internal command.
    ");break;
    25 case 2:printf("command name is md.
    It's function is creat a new directory.
    It's an internal command.
    ");break;
    26 case 3:printf("command name is rd.
    It's function is delete a directory which is empty.
    It's an internal command.
    ");break;
    27 case 4:printf("command name is cls.
    It's function is clean screen
    It's an internal command.
    ");break;
    28 case 5:printf("command name is date.
    It's function is show date.
    It's an internal command.
    ");break;
    29 case 6:printf("command name is time.
    It's function is shio time.
    It's an internal command.
    ");break;
    30 case 7:printf("command name is ren.
    It's function is rename a file.
    It's an internal command.
    ");break;
    31 case 8:printf("command name is copy.
    It's function is copy files.
    It's an internal command.
    ");break;
    32 case 9:printf("dir	cd	md	rd	cls
    date	time	ren	copy
    Enter " quit" to quit this program!!
    ");break;
    33 case 10:printf("Thanks for using it,bye!!
    ");break;
    34 }
    35 return 1;}
    36 printf("No this one!!
    Not a internal commal.
    ");return 0;
    37 }

      心得:

          本次第一次那么潮在晚上提交这个作业,一开始不习惯那个博客链接都漏了发。然后搞了半天才知道怎么搞。其实我C或者java学得马马虎虎,并不怎样。一开始拿到实验一的题目我还是不是很懂什么意思,于是就去百度搜了下,就懂了,于是就参照百度的来打了这个实验。因为比较简单就当初的输入输出都能理解。

  • 相关阅读:
    采坑总结01
    Django设置联合唯一约束 -- migrate时报错处理
    Web前端开发资源整理
    kindEditor 使用
    Django模版语言自定义标签-实现前端 关联组合过滤查询
    django views视图函数返回值 return redirect httpresponse总结
    前端图片实现以瀑布流样式显示
    性能优化中CPU、内存、磁盘IO、网络性能的依赖(转)
    几种浏览器内核(百度百科)
    特殊格式文件(视频、声音等) 在数据库中的存储方式
  • 原文地址:https://www.cnblogs.com/cjy40/p/4396345.html
Copyright © 2011-2022 走看看