C/C++の宿題やらせてください。おながいします
■ このスレッドは過去ログ倉庫に格納されています
0686デフォルトの名無しさん
NGNG#include <iostream>
#include <fstream>
#include <map>
#include <string>
int main()
{
std::string filename;
std::map <int,int> intmap;
while(1)
{
std::cin >> filename;
if(std::cin.fail())
break;
std::ifstream fin(filename.c_str());
std::map<int, int> intmap;
for(;;)
{
int val;
fin >> val;
if(fin.fail())
break;
intmap[val]++;
}
}
std::ofstream fout("out.txt");
for(std::map<int, int>::iterator it=intmap.begin(); it!=intmap.end(); ++it)
{
fout << (*it).first << " " << (*it).second << std::endl;
}
return 0;
}
■ このスレッドは過去ログ倉庫に格納されています