//Downloaded From theonlinetutorials.com
//(C)1999.All rights reserved.
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
int i,j,c=1,l;
char a[100];
cout<<"Enter Array"<<endl;
cin.getline(a,100);
l=strlen(a);
for(i=0;i<l;i++)
{
c=1;
for(j=i+1;j<l;j++)
{
if(a[i]==a[j])
{
c=c+1;
a[j]=' ';
}
}
if(a[i]!=' ')
cout<<"Element"<<a[i]<<"is present"<<c<<"times"<<endl;
}
getch();
}
Not Satisfied ? Just search & get the result
Related posts:
- Sample – Program to identify if an input is a symbol, digit or character.
- Sample – Program to count the number of words and characters in a sentence.
- Sample – Program to convert 2-digit octal number into binary number and print it.
- C++ Program – Calculate Electricity Bill
- Sample – Program to enter salary and output income tax and net salary.
