Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cstring>
  4. using namespace std;
  5. void rezolvare()
  6. {
  7. char mmax[31]="a",mmin[31]="w";
  8. ifstream in("cuvinte.in");
  9. ofstream out("cuvinte.out");
  10. int n,nr;
  11. char a[31];
  12. in>>n;
  13. in.get();
  14. while(in.get(a,30))
  15. {
  16. if(strncmp(a,mmax,30)>0)
  17. strcpy(mmax,a);
  18. if(strncmp(a,mmin,30)<0)
  19. strcpy(mmin,a);
  20. in.get();
  21. }
  22. out<<mmin<<endl;
  23. out<<mmax;
  24. }
  25. int main()
  26. {
  27. rezolvare();
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement