Here's another example of the problem I'm having. When I run this program:
#include <iostream>
using namespace std;
int main()
{
const int MAX_NUM_INTEGERS = 10;
long int integers[10];
long int i = 0, maximumValue = 0;
cout << "Please enter 10 integers : \n\n";
while ( i < MAX_NUM_INTEGERS)
{
cin >> integers[i];
i++;
if (integers[i - 1] > maximumValue)
{
maximumValue = integers[i-1];
}
}
cout << "\nThe largest number you have entered is " << maximumValue << "\n\n";
system("pause");
return 0;
}
It compiles with no errors, when I run the program it takes
11 entries, then it seems to concatenate the first digit of
the first entry with the second entry, so for an entry list like
this :
The output will say that the largest number is 99. Needless
to say, this is very annoying and makes testing programs
much more of a hassle. If anyone has any idea why this is
happening, please let me know. I'm using dev-c++ 4.9.9.2