Averaging 3 integers

后端 未结 4 1637
花落未央
花落未央 2021-01-22 01:16

My assignment is to fix the code. I have my edited code below and the original code below that. I figure I still have a few errors in here. My error checking doesnt seem to w

4条回答
  •  面向向阳花
    2021-01-22 02:03

    Here's how I'd go about correcting the code ...

    1. http://ideone.com/a0UMm -- compilation errors
    2. http://ideone.com/ljUg1 -- warnings, but it works now
    3. http://ideone.com/Qd0gp -- no errors, no warnings, test run ok

    For 1. I used the "original code" as posted by you.

    For 2. I used int main(void), declared the function get_number before defining main, added parenthesis in line 20, and added #include

    For 3. I added return 0; before the final } of main. I also removed the extra output that messed up the ideone interface (it looks better on an interactive interface)


    Edit more tests needed to complete the task of correcting the original code

提交回复
热议问题