C++ Program to Find a latter from string

#include<conio.h>
#include<iostream.h>
#include<stdlib.h>

int function(char*s,char ch)
{ while(*s!='\0')
{
if(*s==ch)
return 1;
s++;
}
return 0;
}
void main(){
char s[]={"My name is usman"};
char ch='w';
if(function(s,ch)==0){
cout<<" not fount ";
}
else
cout<<"Found";

}


0 comments:

Post a Comment

My Instagram