C + + Basic Learning 4

Source: Internet
Author: User

#include  <IOSTREAM> #include  <string>//array Learning Int main () {   //integer array/*  int array[5];   int i;   for  ( i=0;i<5;i++)     {   std::cout<< "please input the value of array[" <<i<< "]" <<std::endl;   std::cin>>array[i];   }    for  ( i=0;i<5;i++)    {   std::cout<<i<< ":" <<array[i]<<std::endl;   }*/  //character Array     // char  buffer[80]={'};    //std::cout<< "please enter a string" < <std::endl;//std::cin>>buffer;//std::cout<< "Here is the buffer ..." <<buffer <<std::endl;//array Copy//char buffer[]= "Hello world";//char buffer2[80]={'};//strcpy ' ( Buffer2,buffer);//std::cout<<buffer2<<std::endl;      //the creation of the string std::string str  ("Hello  world ");std::cout<<str<<std::endl;std::string str2;str2=str;std::cout<<str2< <std::endl;str2= "My name is lilei";std::cout<<str2<<std::endl;std::string  Result=str+str2;std::cout<<result<<std::endl;std::string str3;str3= "My Friend is  lilei "; std::cout<<str3<<std::endl;return 0;}


C + + Basic Learning 4

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.