Principles and Practice of C + + programming 17th part of the answer

Source: Internet
Author: User

1#include <iostream>2 using namespacestd;3 4 voidTo_lower (Char*s)5 {6      while(*s!=' /')7     {8         if(*s>='A'&&*s<='Z')9*s+= +;Tens++; One     } A } -  - Char* STRDUP1 (Const Char*s) the { -     Char*p=New Char[]; -cout<<sizeof(s) <<endl;//////////Note -     inti; +      for(i=0; s[i]!=' /'; i++) -     { +p[i]=S[i]; A     } atp[i]=' /'; -     returnp; - } -  - Char* FINDX (Const Char*s,Const Char*x) - { in     intI=0; -      while(*s!=' /') to     { +          while(* (S+i) ==* (x+i) &&* (x+i)! =' /') -         { thei++; *         } $         if(* (x+i) = =' /')Panax Notoginseng             return(Char*) s; -         Else theI=0; +s++; A     } the     returnNULL; + } -  $ intMain () $ { -     //Char c[]= "D"; -     //cout<<sizeof (&c) <<endl; //////////Note the     //Char *p=strdup1 (c); - //cout<<p<<endl;Wuyi     Charc1[]="FGASDFGHJ"; the     Charc2[]="FGH"; -cout<<findx (C1,C2); Wu      while(1); -     return 0; About  $}
Exercise 3 4 5Exercise TenExercise 11 Exercises 14 Exercise 12 application and other function parameters the latter is required if the const link&, because the latter has declared that it does not change the original value P200 P377

Principles and Practice of C + + programming 17th part of the answer

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.