io20_6.02.c
来自「C++ Primer(第三版)的随书源代码」· C语言 代码 · 共 38 行
C
38 行
// #include <fstream>
#include <fstream.h>
#include "WordCount.h"
/**
**
** note: must include the WordCount.C as well as io20_6.02.c:
** Stan's Silicon Graphics invocation:
**
stanl@john:d.ch20 236 : CC -n32 -experimental io20_6.02.c WordCount.C
stanl@john:d.ch20 237 : a.out
stanl@john:d.ch20 238 : cat word.out
<2> Renoir
<7,12> <34,18>
**
**/
int main()
{
// open a file word.out for output
ofstream oFile( "word.out" );
if ( ! oFile ) {
cerr << "unable to open output file: word.out!\n";
return -1;
}
// create and manually set
WordCount artist( "Renoir" );
artist.found( 7, 12 ); artist.found( 34, 18 );
// invokes operator <<(ostream&, const WordCount&);
oFile << artist;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?