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.