Advertisement
Guest User

inlocuire1

a guest
Oct 23rd, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     char text[256],text1[256],*p,p1[256],t[256]="",separator[]=",. !?   ";
  8.     int i,x,n;
  9.     cin.get(text,256);
  10.     strcpy(text1,text);
  11.     p=strtok(text,separator);   ///primul apel(cuvant)
  12.     while (p!=NULL){ ///atat timp cat mai exista entitati(cuvinte)
  13.         x=p-text;
  14.         n=strlen(p);
  15.         strcpy(p1,p);
  16.         if(n==3)    strcat(t,"*");
  17.         else        strcat(t,p1);
  18.         i=x+n;
  19.         while(text1[i]==' ' ) {
  20.             strcat(t," ");
  21.             i++;
  22.         }
  23.         p=strtok(NULL,separator); ///urmatorul apel
  24.     }
  25.     cout<<t;
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement