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
write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.
Does c have enums?
How can I copy just a portion of a string?
What is the size of empty structure in c?
How many keywords (reserve words) are in c?
What are enumerated types?
Can 'this' pointer by used in the constructor?
How many levels deep can include files be nested?
How can you determine the maximum value that a numeric variable can hold?
What are identifiers in c?
What are the uses of null pointers?
Where is c used?
How can you find the exact size of a data type in c?
What are the types of i/o functions?
What does the characters “r” and “w” mean when writing programs that will make use of files?