//Programme for search 1 name in 5 name array using pointer
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
cout<<"enter first 5 string.\n";
char a[5][10],b[10],*p,*q;
p=a[0];
q=b;
for(int i=0;i<5;i++)
{
gets(p+i*10);
}
cout<<"enter your searching name\n";
gets(q);
int x=0;
for(int i=0;i<5;i++)
{
if(strcmp((p+i*10),q))
x=1;
}
if(x==1)
cout<<"neme found";
}
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
cout<<"enter first 5 string.\n";
char a[5][10],b[10],*p,*q;
p=a[0];
q=b;
for(int i=0;i<5;i++)
{
gets(p+i*10);
}
cout<<"enter your searching name\n";
gets(q);
int x=0;
for(int i=0;i<5;i++)
{
if(strcmp((p+i*10),q))
x=1;
}
if(x==1)
cout<<"neme found";
}
No comments:
Post a Comment