📄 10-0-1.cpp
字号:
#include<iostream>
using std::cout;
using std::cin;
using std::endl;
using std::copy;
char* duplicate_chars(const char* p)
{
//allocate enouth space; remember to add one for the null
size_t length=strlen(p)+1;
char *result=new char[length];
//copy into our newly allocated space and return pointer to first element
copy(p,p+length,result);
return result;
}
int main()
{
int* p=new int(42);
cout<<*p++<<" "<<++*p<<endl;
//43 //43
char str[]="cheng ning is a good student";
cout<<duplicate_chars(str)<<endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -