... there's a newline after the output.
I'd advise reviewing the error message as what your's saying is impossible. The last thing you print to the standard output is a number (50 or 75 or 150 or 300 or 0). It is not followed by anything, definitely not a new line.
You can easily verify this by adding an std::cout << "Hello" << std::endl; before the return 0; statement and see that "Hello" is on the same line as your printed number, not on a new line.
Maybe the error message says that you're supposed to have a new line but you don't have one.
I'm not sure about the logic of how these numbers (0, 50, 75, 150, 300 are determined -- maybe they come from the task description). However, your line else if((drivingSpeed-speedLimit) >= 40) has 40 inclusive, while it's also checked in the previous line of code, so actually your last else if will print 300 starting from 41, not 40. Is this what you wanted to do?