calculations are different in ide vs school server

hi,

so the results of an average() and summation() functions are different in my ide (visual studio) and the school server.

e.g 1, 2, 3, 4, 5
- avg: 3
- sum: 15

e.g 1, a, 2, 3, 4, 5
- avg: 3
- sum: 15

But on my school server, I get this

e.g 1, 2, 3, 4, 5
- avg: 3
- sum: 15

e.g 1, a, 2, 3, 4, 5
- avg: 2.8
- sum: 14

Any idea why? I've debugged in the ide and the values are correct. I've set checks like so:

1
2
3
4
5
6
...
int input;

cout << "Please enter a number: " << endl;
cin >> input
if(!cin) { ... }

Would that affect it?
You have not shown enough code for us to know what is causing the issue. However, whenever you get different results in different environments it is usually a sign of undefined behavior.
Definitely show your code.

What is "a"? Are you reading that from a stream?
Topic archived. No new replies allowed.