A summary of the experiment

Source: Internet
Author: User
Tags strcmp

#include <stdio.h>#include<string.h>voidMain ()/*Main function*/{Char*b[ One]={"dir","CD","MD","Rd","CLS","Date"," Time","Ren","Copy"," Help","quit"};/*pointer array Store keywords*/intPanCharCh1[],Char*j[ One]);Chara[Ten],*p=a;printf ("Welcome.........\npleas Enter a command!\nenter ' quit ' to quit.\nfor help,enter ' help '. \ n"); c1:printf ("c:\>"); scanf ("%s", a);p an (p,b); /*function Call*/if(strcmp (a,b[Ten])!=0)/*compares the input string whether the Quit End command*/ GotoC1;Elseprintf"Out of work!! \ n");}intPanCharCh1[],Char*j[ One])/*Child Functions*/{inti; for(i=0;i< One; i++)if(strcmp (ch1,j[i]) = =0)/*compares the input string to the array's keywords for equality*/{Switch(i) { Case 0:p rintf ("command name is Dir.\nit's function is a list file.\nit ' s an internal command.\nvolume in drive K gas no Label.\nvolume Serial number is 60f0-6c24\n\n"); Break; Case 1:p rintf ("command name is Cd.\nit's function is the change directory.\nit ' s an internal command.\n");  Break; Case 2:p rintf ("command name is Md.\nit's function is creat a new Directory.\nit's an internal command.\n");  Break; Case 3:p rintf ("command name is Rd.\nit's function is delete a directory which is Empty.\nit's an internal command.\n");  Break; Case 4:p rintf ("command name is Cls.\nit's function is a clean screen\nit ' s a internal command.\n");  Break; Case 5:p rintf ("command name is Date.\nit's function is show Date.\nit's an internal command.\n");  Break; Case 6:p rintf ("command name is Time.\nit's function is Shio Time.\nit's an internal command.\n");  Break; Case 7:p rintf ("command name is Ren.\nit's function is rename a file.\nit ' s an internal command.\n");  Break; Case 8:p rintf ("command name is Copy.\nit's function is copy Files.\nit's an internal command.\n");  Break; Case 9:p rintf ("dir\tcd\tmd\trd\tcls\ndate\ttime\tren\tcopy\nenter \ "Quit\" to quit this program!! \ n");  Break; Case Ten:p rintf ("Thanks for using it,bye!! \ n");  Break;}return 1;} printf ("No This one!! \nnot a internal commal.\n");return 0;}

Summary: Fortunately, not difficult.

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.