plssssss help !!....using array.. turbo c..
create a program that will accept number of words to be
consored.
.a word must not exceed 10 characters long
.the text to be entered will be no longer than 200 characters
.there will be no 10 words
example:
enter number of words to be censor: 5
enter words to censor:
windows
office
microsoft
bill
gates
enter text to censor:
bill gates founded microsoft and makes office and windows
sample output:
<consored> <censored> founded <censored> and makes
<censored> and <censored>
Answer / swapnil chhajer
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int nocw,i,j,flag=0;
char
cenWords[20][12],text[205],temp[12],finalText[450]={'\0'};
printf("Enter number of words to be censor : ");
scanf("%d",&nocw);
printf("\nEnter words to be censor : ");
for(i=0;i<nocw;i++)
scanf("%s",cenWords[i]);
fflush(stdin);
printf("\nEnter text to censor : ");
gets(text);
for(i=0;i<strlen(text);i++)
{
j=0;
flag=0;
while(!(text[i]==' '||text[i]=='\t'||text[i]=='\n'))
{
temp[j++]=text[i++];
}
temp[j]='\0';
for(j=0;j<nocw;j++)
{
if(strcmp(temp,cenWords[j])==0)
{
strcat(finalText,"<censored> ");
flag=1;
break;
}
}
if(flag==0)
{
strcat(finalText,temp);
strcat(finalText," ");
}
}
printf("\n\n :: FINAL TEXT :: \n\n");
puts(finalText);
getchar();
return 0;
}
| Is This Answer Correct ? | 6 Yes | 4 No |
Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?
Is it acceptable to declare/define a variable in a c header?
Can a pointer be volatile in c?
Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
Can a variable be both const and volatile?
What is nested structure in c?
#include<stdio.h> #include<conio.h> struct stu { int i; char j; }; union uni { int i; char j; }; void main() { int j,k; clrscr(); struct stu s; j=sizeof(s); printf("%d",j); union uni u; k=sizeof(u); printf("%d",k); getch(); } what is value of j and k.
Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)
2 Answers HCL, IBM, Satyam, Vimal, Vimukti Technologies,
What is a MAC Address?
Is there sort function in c?
what is the advantage of software development
Write a program to generate random numbers in c?