pcount.cpp
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C++ 代码 · 共 32 行
CPP
32 行
#include <strstrea.h>
void main( void ) {
char *pch, s[20];
int len = 30, pc1, pc2;
pch = new char [len];
ostrstream output ( pch, len );
output << "Open Watcom C++" << ends; // write string into the object
pc1 = output.pcount();
cout << "There are " << pc1
<< " characters have been written in the object." << endl;
output << " compiler" << endl;
pc2 = output.pcount();
cout << "There are " << pc2
<< " characters have been written in the object." << endl;
istrstream input ( output.str(), len );
input >> s;
cout << "The first string in the ostrstream object is \""
<< s << "\"" << endl;
input >> s;
cout << "The second string in the ostrstream object is \""
<< s << "\"" << endl;
input >> s;
cout << "The third string in the ostrstream object is \""
<< s << "\"" << endl;
delete pch;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?