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
How can you find the day of the week given the date?
typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?
How can I read a binary data file properly?
What are the types of arrays in c?
What is the purpose of ftell?
What are loops in c?
Explain the process of converting a Tree into a Binary Tree.
struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer
Tell me can the size of an array be declared at runtime?
What is meant by preprocessor in c?
Explain can you assign a different address to an array tag?
What are the features of the c language?
What is data structure in c language?
What is character set?
What 'lex' does?