Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- ifstream fin("ciffrecv.in");
- ofstream fout("ciffrecv.out");
- int v[10];
- int main()
- {
- int x;
- while(fin>>x)
- {
- if(x==7)
- {
- v[7]++;
- }
- else
- {
- if(x==5)
- {
- v[5]++;
- }
- else
- {
- if(x==3)
- {
- v[3]++;
- }
- else
- {
- if(x==2)
- {
- v[2]++;
- }
- }
- }
- }
- }
- if(v[7]!=0)
- {
- fout<<7<<" "<<v[7];
- }
- else
- {
- if(v[5]!=0)
- {
- fout<<5<<" "<<v[5];
- }
- else
- {
- if(v[3]!=0)
- {
- fout<<3<<" "<<v[3];
- }
- else
- {
- if(v[2]!=0)
- {
- fout<<2<<" "<<v[2];
- }
- }
- }
- }
- fin.close();
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement