I need help writing a program which will read in a long int and check whether any of the digits in the number appear more than once.
I need to use an array of type bool which is indexed to 10 and initially set to false. I have written this as below:
int main()
{
int long i,n, num;
bool digits_seen[10];
for (i = 0; i <= 9; i++) {
digits_seen[i]=false;
cout<<digits_seen[i];
}
When the user enters his number n, the program should read in the entire integer and then examine each digit in n and set the appropriate index entry in the array to true to indicate that it has been seen. This is where I am seeking advice. Thanks.


Sign In
Create Account


Back to top









