Untitled


SUBMITTED BY: Guest

DATE: Aug. 27, 2014, 3:47 p.m.

FORMAT: C++

SIZE: 657 Bytes

HITS: 23218

  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<iostream.h>
  4. #include<string.h>
  5. char a[100] , b[10],c[10];
  6. void main()
  7. {
  8. clrscr();
  9. cout<<"please enter a string : ";
  10. gets(a);
  11. cout<<"please enter a word to delete : ";
  12. gets(b);
  13. for(int i = 0 ; i<strlen(a);i++)
  14. {
  15. for(int j = 0 ; a[i]!=' ' && a[i]!='\0' ; i++,j++)
  16. c[j] = a[i];
  17. c[j] ='\0';
  18. if(strcmp(c,b)==0)
  19. for(int h = 0 ;h<=strlen(b) ;h++)
  20. a[i-h] = '\n';
  21. }
  22. cout<<endl<<"the new sentence is : ";
  23. for(int u = 0;u<strlen(a);u++)
  24. if(a[u] != '\n')
  25. cout<<a[u];
  26. getch();
  27. }

comments powered by Disqus