Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

1. Write a C program to count the number of occurrence
of
a specific word in the given strings.
(for e.g. Find how many times the word “live” comes in the
sentence “Dream as if you’ll live forever, live as if
you’ll die today ”)

Answer Posted / ankur

#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
char str[40],ch;
int num;
cout<<"Entre a string :";
cin.getline(str,40);
cout<<"Entre a character :";
cin>>ch;
for(int i=0;i!='\0';++i)
{
if(str[i]==ch)
num=num+1;
}
cout<<num;
getch();
}

Is This Answer Correct ?    20 Yes 74 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does a pointer variable always consist of?

1159


write a program to rearrange the array such way that all even elements should come first and next come odd

2354


What's the right way to use errno?

1201


Is return a keyword in c?

1147


How main function is called in c?

1169


program to convert a integer to string in c language'

2508


Is c is a high level language?

1254


How can I do serial ("comm") port I/O?

1217


When should the const modifier be used?

1155


What is sizeof return in c?

1090


hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .

2508


What is the difference between void main and main in c?

1210


What is #include stdlib h?

1148


What is the difference between int main and void main?

1098


Explain what is the difference between functions getch() and getche()?

1112