Lab 1, lab

Source: Internet
Author: User

Lab 1, lab

# Include <stdio. h>
# Include <string. h>
Main ()
{
Char cmd [20] [20] = {"dir", "cd", "md", "rd", "cls", "date", "time ", "ren", "copy", "help", "quit "};
Char str [20];
While (1)
{
Printf ("Enter the display character :");
Gets (str); // input from the keyboard and display prompt information
If (strcmp (str, cmd [0]) = 0)
{
Printf ("dir indicates no parameter: view files and folders in the current directory \ n ");
}
Else if (strcmp (str, cmd [1]) = 0)
{
Printf ("cd directory name: enter a specific directory \ n ");
}
Else if (strcmp (str, cmd [2]) = 0)
{
Printf ("md directory name: create a specific folder. Dos is used to calling directories, while win is used to calling folders \ 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 ("cls directory name: clear screen function \ n ");
}
Else if (strcmp (str, cmd [5]) = 0)
{
Printf ("date setting date command, the function is to set the date \ n ");
}
Else if (strcmp (str, cmd [6]) = 0)
{
Printf ("time system clock setting command, function: set or display the system period. \ N ");
}
Else if (strcmp (str, cmd [7]) = 0)
{
Printf ("ren indicates changing the file name \ n ");
}
Else if (strcmp (str, cmd [8]) = 0)
{
Printf ("copy indicates the copy command. Its function copy information \ n ");
}
Else if (strcmp (str, cmd [9]) = 0)
{
Printf ("help indicates no parameter: view files and folders in the current directory \ n ");
}
Else if (strcmp (str, cmd [10]) = 0)
{
Printf ("quit indicates exiting ");
}

}

}

 

Conclusion: I didn't quite understand the meaning of the question at the beginning. I gradually understood the question with the help of my friends. However, since I haven't written the code for too long and I don't know how to start it, I had to refer to how others wrote the code on the Internet, and then I remembered the knowledge I learned, I am familiar with it slowly. Although most of them are not written by myself, I have gained a lot.

 

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.