#include<conio.h>
#include<iostream.h>
#include<string.h>
#include<stdio.h>
class
character
{
char
a,str[50];
int
i,flag;
public:
void
readdata();
void
result();
};
void
character::readdata()
{
cout<<"Enter
a string:";
gets(str);
cout<<"Enter
a charecter:";
cin>>a;
flag=0;
for(i=0;str[i]!='\0';i++)
if(str[i]==a)
flag=1;
}
void
character::result()
{
if
(flag==1)
cout<<"charecter
is present";
else
cout<<"charecter
is not present:";
}
void
main()
{
clrscr();
character
obj;
obj.readdata();
obj.result();
getch();
}
No comments:
Post a Comment