Experiment a knowledge of DOS

Source: Internet
Author: User
Tags clear screen strcmp

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

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.