#include #include #include using namespace std; void Output(ostream& ros) { ros << "Hello maniac!" << endl; } int main() { Output(cout); // システムが用意した cout に出力する。 ofstream ofs("D:\\TestOutput.txt"); // ファイルへの出力ストリームオブジェクト ofs を作成する。 Output(ofs); // ofs を渡して、ファイルに出力する。 return 0; }