program to locate string with in a string with using strstr
function
Answer Posted / gmail
#include<iostream.h>
#include<conio.h>
void main()
{
char str1[15],str2[15];
clrsacr();
cout<<"Enter a string";
cin>>str1;
cout<<"\nEnter another string to be located";
cin>>str2;
int n;
n=strstr(str1,str2);
if(n==0)
cout<<"\nstring not locatd";
else
cout<<"At location "<<(n+1);
getch();
}
| Is This Answer Correct ? | 3 Yes | 6 No |
Post New Answer View All Answers
What does double pointer mean in c?
What is the best way to comment out a section of code that contains comments?
What are the 5 data types?
What do you mean by c what are the main characteristics of c language?
which is an algorithm for sorting in a growing Lexicographic order
What is context in c?
Explain which function in c can be used to append a string to another string?
What is array of pointers to string?
write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?
How pointer is different from array?
What is void c?
Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1
List out few of the applications that make use of Multilinked Structures?
What is the purpose of ftell?
What is the difference between a free-standing and a hosted environment?