So I'm asked to write a program that outputs the first N number of frugal numbers.

A frugal number is a number that has more digits than the digits in its prime factorization

(including the number of digits in the powers)

Ex: 1024 = 210

1024 is frugal since it has 4 digits, whereas 210 has 3 digits (2digits in the power).

However in the example above, 225 has 4 digits in its prime factorization and therefore is not frugal.

For example the frugal numbers up to 2000 are:

125, 128, 243, 256, 343, 512, 625, 729, 1024, 1029, 1215, 1250, 1280, 1331, 1369, 1458, 1536, 1681, 1701, 1715, 1792, 1849, 1875

So here is the problem, I cant figure out what have I done wrong, I'd appreciate any help given.

```
#include <iostream>
#include <string>
using namespace std;
bool IsFrugal(int c)
{int icount = 0, digitCount = 0;
for (int i=2; i <= c; i++)
{
while(c % i == 0)
{
c /= i;
icount++;
}
}
{while ( c > 0 )
{
c = c / 10;
digitCount++;
}
}
if (digitCount>icount)
return true;
else
return false;
}
void main()
{
int num;
cout << "Enter a number: ";
cin >> num;
for(int c=1; c<=num; c++)
{
if(IsFrugal(c))
cout<<c;
}
cout<<endl;
}
```

*Edited 5 Years Ago by Ezzaral*: Added code tags. Please use them to format any code that you post.