PRG TO DELETE A ALPHABET IN A STRING

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
int count=0;
char ch[30],nw[30],c;
cout<<“Enter the string :\n”;
gets(ch);
cout<<“\nEnter the alphabet that should not be displayed :”;
cin>>c;
for(int i=0;ch[i]!=”;i++)
{
if(ch[i]!=c)
{
cout<<ch[i];
}
if(ch[i]==c)
{
count++;
}
}
cout<<“\nNumber of occurence of”<<c<<” is “<<count;
getch();
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s