The compiling of the command interpreter program, and the compiling of the command interpreter program

Source: Internet
Author: User

The compiling of the command interpreter program, and the compiling of the command interpreter program

# Include <stdio. h>
# Include <string. h>
Main (){
Char order [15] [10] = {"dir", "cd", "md", "rd", "cls", "date", "time ", "ren", "copy", "help "};
Char string [10], a [10], B [5] [5] = {"YES "};
Int I, j, t = 0;
Printf ("Enter the command :");
Printf ("\ nDo you need help? YES or NO :");
Gets ();
For (I = 0; I <5; I ++ ){
If (strcmp (a, B [I]) = 0)
{
For (I = 0; I <10; I ++)
{
For (j = 0; j <10; j ++)
Printf ("% c", order [I] [j]);
}
Printf ("\ n enter the command :");
T = 1;
}
}
If (t = 0)
Printf ("\ n enter the command :");
 
For (I = 0; I <100; I ++ ){
Gets (string );
If (strcmp (string, order [0]) = 0)
Printf ("dir indicates no parameter: view the files and folders in the current directory. \ T this is an internal command \ n ");
Else if (strcmp (string, order [1]) = 0)
Printf ("cd directory name: enter a specific directory. \ T this is an internal command \ n ");
Else if (strcmp (string, order [2]) = 0)
Printf ("md directory name: create a specific folder. \ T this is an internal command \ n ");
Else if (strcmp (string, order [3]) = 0)
Printf ("rd directory name: delete a specific folder. \ T this is an internal command \ n ");
Else if (strcmp (string, order [4]) = 0)
Printf ("cls clear screen. \ T this is an internal command \ n ");
Else if (strcmp (string, order [5]) = 0)
Printf ("data set date command, function is set date \ t this is internal command \ n ");
Else if (strcmp (string, order [6]) = 0)
Printf ("time system clock setting command, function: set or display the system period. \ T this is an internal command \ n ");
Else if (strcmp (string, order [7]) = 0)
Printf ("Old ren file name New File Name: Change the file name. \ T this is an internal command \ n ");
Else if (strcmp (string, order [8]) = 0)
Printf ("copy path \ file name: copy one file to another. \ T this is an internal command \ n ");
Else if (strcmp (string, order [9]) = 0)
Printf ("help" indicates no parameter: view the files and folders in the current directory. \ T this is an external command \ n ");
Printf ("\ n enter the command :");
}

}

Summary: The programming process is still relatively smooth, because it is a familiar C language programming, so there is no major problem. The goal has been achieved, but I don't know if the program has a small error or is not well-considered. Feeling good!

Related Article

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.