Chapter I.
Experiment one, the writing Experiment of command explanation program
First, the 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.
Test methods, steps and Results
#include <stdio.h> #include <stdlib.h> #include <string.h> int main () {char str[30]; printf ("Please enter command:"); Do{gets (str); if (strcmp (str, "dir") ==0) {printf ("dir means no parameters: View the file currently in the directory \ n"); } else if (strcmp (str, "CD") ==0) {printf ("CD directory name: Enter a specific directory. \ n "); } else if (strcmp (str, "MD") ==0) {printf ("MD Directory name: establishes a specific folder. Dos under the habit called Directory, win under the habit called folder \ n "); } else if (strcmp (str, "RD") ==0) {printf ("Rd Directory name: delete a specific folder. \ n "); } else if (strcmp (str, "CLS") ==0) {printf ("CLS Directory Name: Clear screen function \ n"); } else if (strcmp (str, "data") ==0) {printf ("Data set date command, function is set date \ n"); } else if (strcmp (str, "time") ==0) {printf ("Clock Setup command, function: Set or display system period. \ n "); } else if (strcmp (str, "Ren") ==0) { printf ("Ren" means that the file is renamed, and the Ren command is in the format: the file name of the Ren source file name.) \ n "); } else if (strcmp (str, "copy") ==0) {printf ("Copy represents the Copy command, and the replication information of his function \ n"); } else if (strcmp (str, "help") ==0) {printf ("No Parameters: View files and folders in the current directory \ n"); printf ("CD directory name: Enter a specific directory. \ n "); printf ("MD Directory name: Create a specific folder. Dos under the habit called Directory, win under the habit called folder) \ n "); printf ("Rd Directory name: delete a specific folder.") \ n "); printf ("CLS Directory Name: Indicates clear screen function \ n"); printf ("Data set date command, function is set date \ n"); printf ("Time system clock Settings command, function: Set or display system period.") \ n "); printf ("Ren" means that the file is renamed, and the Ren command is in the format: the file name of the Ren source file name.) \ n "); printf ("Copy means copy command, copy information of his function \ n"); } else {printf ("You entered the wrong information, please reenter: \ n"); }}while (strcmp (str, "quit") ==0) return 0;}
After this study, let me review the freshman learned C + +, this learning deep experience, I will continue to work
10-leaf Baoan