📄 main.cpp
字号:
#include <cstdlib>
#include <iostream>
#include<cstring>
using namespace std;
int main(int argc, char *argv[])
{
/* int errors=0;
const char*pc="a very long string";
for(int ix=0;ix<10;++ix)
{
int len=strlen(pc);
char *pc2=new char[len+1];
strcpy(pc2,pc);
cout<<pc2<<endl;
if(strcmp(pc2,pc))
++errors;
delete []pc2;
}
cout<<"c_style character strings:"<<errors<<"errors occurred.\n";*/
int errors=0;
string str("a very string");
for(int ix=0;ix<1000000;++ix)
{
int len=str.size();
string str2=str;
if(str!=str2)
++errors;
cout<<str2<<endl;
}
cout<<"c_style character strings:"<<errors<<"errors occurred.\n";
system("PAUSE");
return EXIT_SUCCESS;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -