Advertisement
Theerayut

compleattype

Dec 9th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. typedef struct
  4. {
  5.     char name[51];
  6. }student;
  7. void output(student a,char t);
  8. int main()
  9. {
  10.     student n;
  11.     char l;
  12.     printf("Word : ");
  13.     scanf("%s",n.name);fflush(stdin);
  14.     printf("Cut : ");
  15.     scanf("%c",&l);
  16.     output(n,l);
  17.     return 0;
  18.    
  19. }
  20.  
  21. void output(student a,char t)
  22. {
  23.     int i,j;
  24.    
  25.     for(i=0;i<strlen(a.name);i++)
  26.     {
  27.         if(a.name[i]==t)
  28.         {
  29.             for(j=i;j<strlen(a.name);j++)
  30.             {
  31.                 a.name[j]=a.name[j+1];
  32.             }
  33.             i--;
  34.         }  
  35.     }
  36.     printf("After : %s",a.name);
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement