Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstring>
- using namespace std;
- int main()
- {
- ifstream dane("liczby.txt");
- ofstream wynik("wynik6.txt");
- int i=0;
- int licznik=0;
- string array[1000];
- while(i<1000)
- {
- dane >> array[i];
- i++;
- }
- string m=array[0];
- int k= m.length();
- cout << m;
- int j=1;
- while(j<1000)
- {
- int dl=array[j].length();
- if(k<dl)
- {
- m=array[j];
- }
- if(k==dl)
- {
- for(int i=0;i<dl;i++)
- {
- if(array[j][i]>m[i]) m=array[j];
- }
- }
- j++;
- }
- cout << m << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment