A summary of the experiment

Source: Internet
Author: User
Tags strcmp

Program Source code:

#include <stdio.h>#include<string.h>intMain () {Chars2[ -][ -]={"dir","CD","MD","Rd","CLS","Date",        " Time","Ren","Copy"," Help","quit"}; //defines the array, stores the required commands in the array, and calls the    Chars1[ -];  while(1) {printf ("Please enter a display character:");    Gets (S1); //use strcmp (S1,S2) to determine    if(strcmp (s1,s2[0])==0) {printf ("dir No parameters: View the files and folders that are currently in your directory. This is an internal command \ n"); }    Else if(strcmp (s1,s2[1])==0) {printf ("CD Directory Name: Enter a specific directory. This is an internal command \ n"); }    Else if(strcmp (s1,s2[2])==0) {printf ("MD Directory Name: Create a specific folder. Dos under the habit called Directory, win under the habit called folder. This is an internal command \ n"); }    Else if(strcmp (s1,s2[3])==0) {printf ("Rd Directory Name: Deletes a specific folder. This is an internal command \ n"); }    Else if(strcmp (s1,s2[4])==0) {printf ("CLS Directory Name: Clears the screen. This is an internal command \ n"); }    Else if(strcmp (s1,s2[5])==0) {printf ("Date Sets the day command, which is the set date. This is an internal command \ n"); }    Else if(strcmp (s1,s2[6])==0) {printf ("Time system Clock Settings command, function: Set or display system times. This is an internal command \ n"); }    Else if(strcmp (s1,s2[7])==0) {printf ("Ren means that the file is renamed, and the Ren command is in the format: the file name of the Ren source file. This is an internal command \ n"); }    Else if(strcmp (s1,s2[8])==0) {printf ("Copy represents a copy command, and its function is to copy information. This is an internal command \ n"); }    Else if(strcmp (s1,s2[9])==0) {printf ("provides help information for Windows commands \ n"); printf ("dir No parameters: View the files and folders that are currently in your directory. This is an internal command \ n"); printf ("CD Directory Name: Enter a specific directory. This is an internal command \ n"); printf ("MD Directory Name: Create a specific folder. Dos under the habit called Directory, win under the habit called folder. This is an internal command \ n"); printf ("Rd Directory Name: Deletes a specific folder. This is an internal command \ n"); printf ("CLS Directory Name: Clears the screen. This is an internal command \ n"); printf ("Date Sets the day command, which is the set date. This is an internal command \ n"); printf ("Time system Clock Settings command, function: Set or display system times. This is an internal command \ n"); printf ("Ren means that the file is renamed, and the Ren command is in the format: the file name of the Ren source file. This is an internal command \ n"); printf ("Copy represents a copy command, and its function is to copy information. This is an internal command \ n"); }    Else if(strcmp (s1,s2[Ten])==0) {printf ("This is an external command \ n"); return 0; }        Else{printf ("you enter the wrong information, please re-enter: \ n"); }    }}

Summarize:

This is the first experiment in the course of the operating system tutorial to write code. To tell the truth, there have been many problems in doing this experiment, although I have already learned to write code in C language before, but because the results have not been ideal, and after the end of the study of C language after the extracurricular did not contact with C, so that before doing this experiment, I am not very familiar with C. However, after the guidance of the students and their own on-line to check the information, and ultimately it is very smooth to the DOS command program written out. In fact, in the process of compiling this program, because the wrong way to make this program into the dead loop, fortunately, by looking for problems or solve the problem, and finally perfected the program. After this experiment, I have a deep understanding of the C programming method, and I hope to understand it further and skillfully use it in future programming.

A summary of the experiment

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.