#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