Thank you
Guinness
Expand|Select|Wrap|Line Numbers
- #include <iostream>
- #include <iomanip>
- #include <cstdlib>
- #include <fstream>
- using namespace std;
- void open_input_file(ifstream &inf);
- int main()
- {
- ifstream from_file;
- open_input_file(from_file);
- int i=0;
- int j=0;
- int f[30];
- int a=0;
- for(j=0;j<=29; j++)
- {
- f[j]=0;
- }
- from_file>>a;
- int mode=f[0];
- while(!from_file.eof())
- {
- i=a;
- f[i]=f[i]+1;
- cout<<i<<" "<<f[i]<<" "<<mode<<endl;
- from_file>>a;
- }
- void open_input_file(ifstream &inf)
- {
- char input_file_name[80];
- do
- { inf.clear();
- cout<<"Enter input file name: ";
- cin>>input_file_name;
- inf.open(input_file_name);
- } while (inf.fail());
- }