>yech, that looks sloppy, the indenting looks better in the IDE.
The closing tag for code uses a forward slash rather than a backslash. There's an obvious watermark in the post editor window that shows you exactly how to do it, so you really have no excuses.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
I am using dev-c++ 4.9.9.1 and your last code works just fine (Windows XP). I think the version should not make any difference, that is only an update of the IDE. Are you using g++ as the compiler?
I added a few test lines to your code ...
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
const int MAX_NUM_INTEGERS = 10;
long int integers[10];
long int i = 0, maximumValue = 0;
int k;
cout << "Please enter 10 integers : \n\n";
while ( i < MAX_NUM_INTEGERS)
{
cout << i << " "; // for testing
cin >> integers[i];
i++;
if (integers[i - 1] > maximumValue)
{
maximumValue = integers[i-1];
}
}
// test cout of the array
for (k = 0; k < sizeof(integers)/sizeof(int); k++)
cout << integers[k] << endl;
cout << "\nThe largest number you have entered is " << maximumValue << "\n\n";
system("pause");
return 0;
}
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417