>>727
// main.cpp
#include "Student_info.h"
#include "average.h"
#include <iostream>
#include <fstream>
#include <iterator>
#include <algorithm>
#include <vector>
int main()
{
using namespace std;
// ifstream infile( "in.txt" );
ofstream outfile( "out.txt" );
Student_info s;
vector< Student_info > students;
// (1)各学生の点数をキーボードから入力すること。
cout << "成績を入力せよ(学生名 国語 英語 数学):" << endl;
copy( istream_iterator< Student_info >( cin ), istream_iterator< Student_info >(),
back_inserter( students ) );
// (2)合計、及び平均を求める箇所を関数とすること。
// (合計は Student_info クラスの メンバ関数)
// (3)結果をファイル(kekka.txtなど)に出力すること。
copy( students.begin(), students.end(), ostream_iterator< Student_info >( outfile, "\n" ) );
outfile << "英語平均:" << average( students, accum_english ) << endl;
outfile << "数学平均:" << average( students, accum_mathematic ) << endl;
outfile << "国語平均:" << average( students, accum_japanese ) << endl;
// 2、問題1で作成したプログラムを、合計点が大きい順にソートして出力するように変更しなさい。
sort( students.begin(), students.end(), compare_sum );
copy( students.begin(), students.end(), ostream_iterator< Student_info >( outfile, "\n" ) );
return 0;
}