SOURCE program:
#include <stdio.h>
#include <stdlib.h>
#include <String.h>
void Main ()
{
Char cmd[20][20]={"CD", "dir", "CLS", "RD", "MD", "Date", "Time", "Ren", "Copy", "Help", "quit"};
Char str[20]; This is an array of definitions, and the required commands are stored in the array and are called when needed.
while (1)
{
printf ("Please enter the indicator:");
Gets (str);//This is input from the keyboard and displays the information before.
if (strcmp (str,cmd[0]) ==0)
printf ("CD directory name: Enter a specific directory. \ n ");
else if (strcmp (str,cmd[1]) ==0)
printf ("dir means no parameters: View files and folders in the current directory \ n");
else if (strcmp (str,cmd[2]) ==0)
printf ("CLS Directory Name: Indicates clear screen function. \ n");
else if (strcmp (str,cmd[3]) ==0)
printf ("Rd Directory name: delete a specific folder. \ n");
else if (strcmp (str,cmd[4]) ==0)
printf ("MD Directory name: establish a specific folder. Dos under the habit called Directory, win under the habit called folder. \ n");
else if (strcmp (str,cmd[5]) ==0)
printf ("Data set date command, function is set date. \ n");
else if (strcmp (str,cmd[6]) ==0)
printf ("Time system clock Settings command, function: Set or display system period. \ n");
else if (strcmp (str,cmd[7]) ==0)
printf ("Ren" means that the file changed to a name, the format of the Ren command is: The file name of the Ren source file name. \ n ");
else if (strcmp (str,cmd[8]) ==0)
printf ("Copy means copy command function: Copy information. \ n");
else if (strcmp (str,cmd[9]) ==0)
{
printf ("No Parameters: View the files and folders in the directory where you are currently located. \ n");
printf ("CD directory name: Enter a specific directory. \ n");
printf ("MD Directory name: establish 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 changed to a name, the format of the Ren command is: The file name of the Ren source file name. \ n ");
printf ("Copy means copy command function: Copy information. \ n");
}
else if (strcmp (str,cmd[10]) ==0) {
Return
}
else{
printf ("You enter the wrong information, please reenter. \ n");}
}
}
Run:
Experiment a knowledge of DOS