I am working on a c++ assignment and I need to display the smallest and largest values of an array called from a .txt file...but I don't know how to display them...any guidance?
for (int i=0; i < 36; i++)
{
cout << array[i] << " ";
}
cout << "\n\n";
int min = 0;
int max = 0;
if(array[i]<min)
{
min = array[i];
}
cout << "The smallest value is: " << min << endl;
cout << "The largest value is: " << max << endl;
return 0;
}
and the error message is:
assignment8.cpp: In function ‘int main()’:
assignment8.cpp:36: error: name lookup of ‘i’ changed for ISO ‘for’ scoping
assignment8.cpp:36: note: (if you use ‘-fpermissive’ G++ will accept your code)