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