Need a project done?

C++ Programming Developer

Search This Blog

Frequency Counter in C++

//This Program tells the Frequency of Numbers in an array.


#include <iostream.h>

void main()
{
int a[10] = {1,2,2,2,3,3};
int f[10] = {0};
for (int i = 0; i<10 ; i++)
f[a[i]]++;

for (i = 1; i<10; i++)
cout << i <<" appears "<<f[i]<<" times."<<endl;

}

1 comment:

"Don't let anyone ever make you feel like you don't deserve what you want."