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

How can I convert a number to a string?

1095


How main function is called in c?

1072


What does != Mean in c?

987


Explain bitwise shift operators?

1171


What does sizeof int return?

1025


What does the characters “r” and “w” mean when writing programs that will make use of files?

1422


How can you avoid including a header more than once?

928


What is the data segment that is followed by c?

1032


Write a program to check whether a number is prime or not using c?

1009


void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply

2703


What are qualifiers and modifiers c?

940


Is it better to use a macro or a function?

1099


Explain how can I write functions that take a variable number of arguments?

1028


given post order,in order construct the corresponding binary tree

2724


Multiply an Integer Number by 2 Without Using Multiplication Operator

724