Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <iostream>
- #include <fstream>
- #define SIZE 50
- using namespace std;
- int main()
- {
- char buf[SIZE];
- char max_char;
- int code;
- int max = -1;
- ofstream fout1("input.txt");
- fout1 << "8fhg/fgeGHB_%67jHdAsHNajeSGDGFIiDhasjMZFKhjs~dhdX";
- fout1.close();
- ifstream fin("input.txt");
- fin.getline(buf, SIZE);
- fin.close();
- //65..90, 97..122
- for (int i = 0; i < SIZE - 1; i++)
- {
- code = buf[i];
- if (((code > 64 && code < 91) || (code > 96 && code < 123)) && (code > max))
- {
- //printf("%c = %d\n", buf[i], code);
- max = code;
- max_char = buf[i];
- }
- }
- ofstream fout2("output.txt");
- fout2 << buf << endl;
- fout2 << "max char is ";
- fout2 << max_char;
- fout2.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement