Advertisement
STANAANDREY

pb2 28/1/2020

Jan 28th, 2020
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. #include <fstream>
  2. #include <iostream>
  3. #include <cstring>
  4. #include <ctype.h>
  5. #include <stdio.h>
  6. using namespace std;
  7. #define NMAX 100
  8. #define LENMAX 256
  9. #define INFILE "SIRURI.TXT"
  10.  
  11. int numarare(char s[], int& nrl)
  12. {
  13.     nrl = 0;
  14.     for (int i = 0; s[i]; i++)
  15.         if (isupper(s[i]))
  16.             nrl++;
  17. }
  18.  
  19. void read(int& n, char c[][LENMAX])
  20. {
  21.     ifstream fin(INFILE);;
  22.     fin >> n;
  23.     fin.get();
  24.     for (int i = 0; i < n; i++)
  25.         fin.getline(c[i], LENMAX);
  26. }
  27.  
  28. char c[NMAX][LENMAX], r[LENMAX];
  29. int n;
  30. int maxi = -1, cnr;
  31. int main()
  32. {
  33.     read(n, c);
  34.     for (int i = 0; i < n; i++)
  35.     {
  36.         numarare(c[i], cnr);
  37.         if (maxi <= cnr)
  38.         {
  39.             maxi = cnr;
  40.             strcpy(r, c[i]);
  41.         }
  42.     }
  43.  
  44.     puts(r);
  45.     return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement