Averaging 3 integers

后端 未结 4 1632
花落未央
花落未央 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:00

    You got the floating point parsing all wrong and shouldn't be doing it yourself. There's an easier way:

    double get_number(double num) { 
      double value = 0.0;
      printf("Please input number %lf: ", num);
      scanf("%lf", &value);
      return(value);
    }
    

提交回复
热议问题