⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 io20_6.02.c

📁 C++ PRIME书中的原代码,看本书时可以学习的例子.
💻 C
字号:
// #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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -