Alx09

Untitled

May 28th, 2021
1,029
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. #include<fstream>
  4.  
  5. #include<string.h>
  6.  
  7. using namespace std;
  8.  
  9. int main(){
  10.  
  11.    ifstream f("cuvant.in");
  12.  
  13.    char cuv[1000],cuvMax[1000];
  14.  
  15.    int n,i;
  16.  
  17.    f>>n>>cuv; strcpy(cuvMax,cuv);
  18.  
  19.    for(i=1;i<n;i++){
  20.  
  21.        f>>cuv;
  22.  
  23.        if(strcmp(cuv,cuvMax)==1)
  24.  
  25.            strcpy(cuvMax,cuv);
  26.  
  27.    }
  28.  
  29.    ofstream o("cuvant.out");
  30.  
  31.    o<<cuv;
  32.  
  33.    f.close();
  34.  
  35.    o.close();
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment