Advertisement
xotohop

files

May 1st, 2020
698
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <iostream>
  3. #include <fstream>
  4.  
  5. #define SIZE 50
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     char buf[SIZE];
  12.     char max_char;
  13.     int code;
  14.     int max = -1;
  15.    
  16.     ofstream fout1("input.txt");
  17.     fout1 << "8fhg/fgeGHB_%67jHdAsHNajeSGDGFIiDhasjMZFKhjs~dhdX";
  18.     fout1.close();
  19.    
  20.     ifstream fin("input.txt");
  21.     fin.getline(buf, SIZE);
  22.     fin.close();
  23.  
  24.     //65..90, 97..122
  25.    
  26.     for (int i = 0; i < SIZE - 1; i++)
  27.     {
  28.         code = buf[i];
  29.         if (((code > 64 && code < 91) || (code > 96 && code < 123)) && (code > max))
  30.         {
  31.             //printf("%c = %d\n", buf[i], code);
  32.             max = code;
  33.             max_char = buf[i];
  34.         }
  35.     }
  36.  
  37.     ofstream fout2("output.txt");
  38.     fout2 << buf << endl;
  39.     fout2 << "max char is ";
  40.     fout2 << max_char;
  41.     fout2.close();
  42.  
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement