The preparation of an experimental command interpreter

Source: Internet
Author: User

I. Purpose and Requirements

1. Purpose of the experiment

(1) Master the Principle of command interpretation procedure;

(2) Master the simple Dos call method;

(3) Master C language programming preliminary.

2 . Experimental requirements

Write a command-line interpreter similar to Dos,unix

(1) Self-defined system prompt

(2) Custom set of commands (8-10)

(3) User input Help to find commands

(4) List the function of the command, distinguish internal or external commands

(5) User input quit quit

(6) Internal commands are dir, CD, MD, RD, CLS, date, time, Ren, copy, etc.

Ii. contents of the experiment

According to the task assigned by the teacher, the design, coding and testing work is done.

three , experimental environment

1. PC Microcomputer

2. Windows Operating System

3. A/C + + program Development Integration Environment

Four, the experiment principle and core algorithm reference program segment (abstract)
voidMain () {intI=0; Seefirst (i); I=cmd (i);if(i== About) {printf ("Thank you!bye~\n");}}voidSeefirst () {printf ("Microsoft Window [version 6.1.7601]\n"); printf ("Copyright <c> Microsoft Corporation. "); printf ("retain ownership. \ n"); printf ("\ n"); printf ("e:\>"); }intcmd () {CharCh[n];intI=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 ();} Elseprintf"warning!\n"); } while(ch=='quit'); return  About; }


Experiment Summary:

In this experiment, I think the idea is not wrong, but always feel that the details of what to forget, the program has not been implemented, but there is no direction where the problem arises.

A little distressed. (not to be continued ...) )

The preparation of an experimental command interpreter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.