I misunderstood my assignment earlier. I now understand for the part with :
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
that the code was supposed to extract the largest and smallest digit. I did that in my code now:
Code:
for(i = 0; i < count; i ++){
temp = numbers[i];
while (temp!= 0){
if (temp < 0) {
temp = -temp;
}
numExtract = temp % 10;
temp /= 10;
if( numExtract > largeDigit ){
largeDigit = numExtract;
}
if( numExtract < smallDigit ){
smallDigit = numExtract;
}
}
}
cout << "\n";
cout << "The smallest digit: " << smallDigit << endl;
cout << "The largest digit: " << largeDigit << endl;
The only thing I need to do now is print out which lines have the smallDigit and largeDigit on them.
Can anyone please help me? I'm stuck and I don't know what to do. How do I find what line (index) smallDigit and largeDigit are on?? I will appreciate ANY help.