C++基礎学習4

1238 ワード

#include <IOSTREAM>
#include <STRING>
//     
int main(){
   //    
/* 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;
   }*/
  
	
	//    
    // char buffer[80]={'\0'};
    //std::cout<<"Please enter a String"<<std::endl;
	//std::cin>>buffer;
	//std::cout<<"Here is the buffer..."<<buffer<<std::endl;
	//    
	//char buffer[]="hello world";
	//char buffer2[80]={'\0'};
	//strcpy(buffer2,buffer);
	//std::cout<<buffer2<<std::endl;
  
    //      
	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;

}