Here is an even or odd program. I need to sum the even values up to 180 and odd values up to 160. Each time I run this program, the output is even = 8190 odd 6400. I believe the correct outputs are even = 8010 and odd = 6241. Can you help me understand what I am doing wrong?
Also, I would like to add, I don't want to alter the syntax of any of the code. It works properly.
why is it <= for even and < for odd?
run it with something you are absolutely sure the answer of, like 10.
1+3+5+7+9 is 25.
2+4+6+8+10 is 30.
do those work?
It works properly.
??? if it worked properly, you would get the correct answers. But I get that you don't want a rewrite, it just struck me funny...
Same result. So your assumptions seem to be wrong.
_____________________________________________
My output is wrong
I don't want to alter the syntax of any of the code. It works properly.
So does it work properly or does it not?
If you're referring to previous requests to just print to cout instead of a file, let me explain it in a different way: It doesn't matter to us that your professor forces you to write to a file. If you want help from us, it make our lives easier if we can immediately run code that prints to cout, instead of having to edit the source code ourselves to have it print to cout instead of a file.
We'll still help you either way, but it would be nicer if we didn't have to edit your source code every time to get it to run properly on cpp.sh