C++基础学习4
2014-12-07 19:52
134 查看
#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; }
相关文章推荐
- C++学习笔记——基础知识
- 《面向对象基础:C++实现》学习笔记之四
- C/C++ 基础知识学习笔记 (不断更新中)
- C++基础(学习笔记)
- C++学习(八)函数基础
- 回复:学习java必须有c++基础么?
- c++基础学习第二天(c++程序的结构)
- C++学习笔记(一)--基础知识sizeof用法
- Symbian C++学习之——菜单基础
- C++基础教程 学习笔记(二) 数组、字符串和指针
- 《面向对象基础:C++实现》学习笔记之五
- 《面向对象基础:C++实现》学习笔记之七
- C++学习(4)--基础知识(4)--关于const
- VC、C++基础学习
- 学习c++基础
- 《面向对象基础:C++实现》学习笔记之三
- C++学习(3)--基础知识(3)--关于操作符的重载
- C++/GDI+ 学习笔记(三)——基础
- 学习笔记-C++搞Mobile基础
- c++基础学习第一天(类与对象)