#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<process.h>
#include<stdio.h>
void main()
{
char strng1[100], x;
int len1, len2;
cout<<"enter a string : ";
gets(strng1);
len1=strlen(strng1);
cout<<"enter the letter to be searched : ";
cin>>x;
{
textcolor(2);
textbackground(0);
}
for(int i=0 ; i<len1 ; i++)
{
if(strng1[i]==x)
{
cprintf("(");
cout<<strng1[i];
cprintf(")");
}
else
cout<<strng1[i];
}
getch();
}
.................................................................
OUTPUT :(click to enlarge the image)
No comments:
Post a Comment