Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- void search(int m[], int size, int &max, int &col)
- {
- for (int i=0; i< size;i++)
- {
- if (max==m[i])
- count++;
- if (m[i]>max)
- {
- count = 1;
- max=m[i];
- }
- }
- }
- int main()
- {
- ifstream fin("DATA.txt");
- int n,max=0,count=0,mas[500];
- fin >> n;
- for (int i=0;i<n;i++)
- {
- fin >> mas[i];
- }
- fin.close();
- search(mas, n, max, count);
- ofstream fout("REZ.txt");
- fout << max << " " << count;
- fout.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment