Advertisement
Five_NT

prbl.4

Dec 21st, 2015
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.96 KB | None | 0 0
  1.     char chr[] = " .,-;:'""()?!", ss[2000]="", s[1000];
  2.     ifstream fin(input_file_name);
  3.     while(fin.get(s, 256))
  4.     {
  5.         int n = strlen(s);
  6.         for(int i = 0; i<(int)strlen(s); i++)
  7.         {
  8.                 while(i<n && strchr(chr, s[i]))
  9.                 {
  10.                     for(unsigned int j = i; j<strlen(s); j++)
  11.                         s[j] = s[j+1];
  12.                     n--;
  13.                 }
  14.         }
  15.  
  16.         strcat(ss, s);
  17.         fin.get();
  18.     }
  19.  
  20.     if((int)strlen(ss) < N)
  21.         N = strlen(ss);
  22.  
  23.  
  24.     char s1[N], aux[N];
  25.     unsigned int poz = -1;
  26.  
  27.     strncpy(aux, ss, N);
  28.     strncpy(s1, ss, N);
  29.     for(int i = 0; i<N; i++)
  30.     {
  31.         char c[1];
  32.         c[0] = s1[0];
  33.         for(int j = 0; j<N-1; j++)
  34.             s1[j] = s1[j+1];
  35.         s1[N-1] = c[0];
  36.         //cout << s1 << endl;
  37.         if(strcmp(aux, s1) > 0)
  38.         {
  39.             strncpy(aux, s1, N);
  40.             poz = i + 1;
  41.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement