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

    一、目的和要求
    1. 实验目的
    (1)掌握命令解释程序的原理;
    (2)掌握简单的DOS调用方法;
    (3)掌握C语言编程初步。
    2.实验要求
    编写类似于DOS,UNIX的命令行解释程序
    (1)自行定义系统提示符
    (2)自定义命令集(8-10个)
    (3)用户输入HELP以查找命令的帮助
    (4)列出命令的功能,区分内部还是外部命令
    (5)用户输入QUIT退出
    (6)内部命令有dir, cd, md, rd, cls, date, time, ren, copy等。
    二、实验内容
    根据教师指定的实验课题,完成设计、编码、测试工作。
    三、实验环境
    1.PC微机
    2.Windows 操作系统
    3.C/C++程序开发集成环境
    void main() 
    
    {  int i=0; 
    
     seefirst(i);
    
     i=cmd(i);
    
     if(i==99)  {
    
     printf("Thank You!bye~
    ");
    
    }}
    
    void seefirst(){
    
     printf("Microsoft Window [版本 6.1.7601]
    ");
    
     printf("版权所有 <c> 2009 Microsoft corporation。");
    
     printf("保留所有权。
    ");
    
     printf("
    ");
    
     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!
    "); 
    
    }while(ch=='quit');
    
     return 99; }
    复制代码

    实验总结:本次实验做得相对顺利,对相关的知识有了一个系统全面的理解。
  • 相关阅读:
    IDEA安装步骤
    记录常用网站
    IDEA解决中文乱码问题
    使用IDEA 中 实现springboot 热部署 (spring boot devtools版)
    Springboot学习
    写文档步骤
    some untracked working tree files问题解决
    利用mybatis-generator自动生成代码
    Java实现打印功能
    sql语句大全
  • 原文地址:https://www.cnblogs.com/xkb07/p/4568049.html
Copyright © 2011-2022 走看看