Why does this program only display the last value in the array and not all 10?
PHP Code:#include <iostream>
using namespace std;
int main()
{
const int NUM_MEN = 10;
int fish[NUM_MEN], cought = 0;
for (int count = 0; count < NUM_MEN; count++)
{
cout << "How many fish did fisherman " << count+1 << " catch? ";
cin >> fish[cought];
}
for (int count = 0; count < NUM_MEN; count++)
{
cout << "\nFisherman " << count+1 << " cought " << fish[cought] << " fish" << endl << endl;
}
return 0;
}




Reply With Quote