Hey guys, basically I need to extract 2 numbers, a small and large number chosen by using cin to input, in an array.
Example:
How many integers? 3
Enter integer #1: 12795
Enter integer #2: -2784
Enter integer #3: -27904
The smallest digit: 0
Digit 1 can be found in integer number(s): 3
The largest digit: 9
Digit 9 can be found in integer number(s): 1, 3
*Bold indicates an entered number (input)*
So far this is my code:
Code:
int numbers[0];
int count;
cout << "\tHow many integers do you have? ";
cin >> count;
cout << "\n";
int i;
int NumExtract;
for(i = 0; i < count; i ++){
cout << "\t\tEnter integer #" << i + 1 << " : ";
cin >> numbers[i];
}
for(i = 0; i < count; i ++){
while (numbers[i] != 0){
if (numbers[i] < 0) {
numbers[i] = -numbers[i];
}
NumExtract = numbers[i] % 10;
numbers[i] /= 10;
}
}
This basically gets the numbers to input and everything and extracts the numbers but I'm trying to figure out how to make it so the code knows which Integer line the specified "large/small" number comes from.
Also, is a for loop good for this sort of problem?