nicuvlad76

Untitled

Nov 27th, 2020
566
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cstring>
  3. #define N 301
  4. using namespace std;
  5. char s[51],t[101], cuv[4][10]={"COLEGIUL", "LICEUL", "NATIONAL", "TEORETIC"};
  6. char *p, aux[51];
  7. int n;
  8. int main()
  9. {
  10.    cin.getline(s,50);
  11.    p=strtok(s," ");
  12.    while(p)
  13.    {
  14.        if(strchr(p,'.'))
  15.        {
  16.           if(p[0]=='C') strcpy(aux,cuv[0]);
  17.           else if(p[0]=='L') strcpy(aux,cuv[1]);
  18.           else if(p[0]=='N') strcpy(aux,cuv[2]);
  19.           else if(p[0]=='T') strcpy(aux,cuv[3]);
  20.           else strcpy(aux,p);
  21.        }
  22.        else strcpy(aux,p);
  23.        if(n!=0)strcat(t," ");
  24.        strcat(t,aux);
  25.        n++;
  26.        p=strtok(NULL," ");
  27.    }
  28.    cout<<t;
  29.     return 0;
  30. }
  31.  
RAW Paste Data