Guest User

Untitled

a guest
Jul 16th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.13 KB | None | 0 0
  1. #include <stdio.h>
  2. #include<string.h>
  3.  
  4.  
  5. int main ()
  6.  
  7. {
  8.     char comandao [2500];
  9.     scanf("%s", comandao);
  10.     char *p ;
  11.     int aux, cont;
  12.     cont = 0;
  13.     {
  14.  
  15.         /*  Contador de ; */
  16.         for (aux=0; comandao[aux] != '\0'; aux++)
  17.         {
  18.             if ( comandao[aux] == ';' )
  19.                 cont = cont +1;
  20.         }
  21.         cont = cont+1;
  22.  
  23.  
  24.        /*comando em si*/
  25.         while (cont > 0)
  26.         {
  27.             p = strchr(comandao, ';');
  28.             int tamanhao, tamaninho , tamanhedio;
  29.  
  30.             tamanhao = strlen(comandao);
  31.  
  32.             printf("%d \n", tamanhao);
  33.  
  34.             tamanhedio = strlen(p);
  35.  
  36.             printf("%d \n", tamanhedio);
  37.             tamaninho = tamanhao - tamanhedio;
  38.  
  39.             printf("%d \n", tamaninho);
  40.  
  41.             char comando1 [50];
  42.             strncpy(comando1, comandao , tamaninho);
  43.             comando1[tamaninho]='\0';
  44.             printf("%s \n", comando1);
  45.             memset(comando1,0,50);
  46.  
  47.             cont = cont - 1;
  48.             p++;
  49.  
  50.             strcpy(comandao,p);
  51.             puts(comandao);
  52.  
  53.         }
  54.     }
  55.  
  56.     return 0;
  57.  
  58. }
Add Comment
Please, Sign In to add comment