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 is the c language function prototype?
What are actual arguments?
What is variables in c?
What are structure members?
Explain the use of keyword 'register' with respect to variables.
how can i access hard disk address(physical address)? are we access hard disk by using far,near or huge pointer? if yes then please explain.....
difference between native and cross compilers
Declare the structure which contains the following members and write in C list of all students who score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.
Can I initialize unions?
Write the program with at least two functions to solve the following problem. The members of the board of a small university are considering voting for a pay increase for their 10 faculty members. They are considering a pay increase of 8%. Write a program that will prompt for and accept the current salary for each of the faculty members, then calculate and display their individual pay increases. At the end of the program, print the total faculty payroll before and after the pay increase, and the total pay increase involved.
What is the purpose of clrscr () printf () and getch ()?
What is the purpose of void pointer?
Explain #pragma statements.
What is the ANSI C Standard?
Can we assign string to char pointer?