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


Please Help Members By Posting Answers For Below Questions

Is void a keyword in c?

570


Which programming language is best for getting job 2020?

605


explain what is an endless loop?

607


The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference

669


When we use void main and int main?

588






What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

899


Explain function?

659


What are variables and it what way is it different from constants?

780


How can I write a function analogous to scanf?

648


In c programming language, how many parameters can be passed to a function ?

626


what do you mean by inline function in C?

607


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

2264


What are the types of variables in c?

578


What is string function in c?

531


Is that possible to add pointers to each other?

892