Home  >  Q&A  >  body text

c++ - 为什么平均成绩是负数,而且是发生异常?

迷茫迷茫2764 days ago524

reply all(3)I'll reply

  • 天蓬老师

    天蓬老师2017-04-17 13:30:18

    No exception occurred

    float ever;
    

    changed to

    float ever = 0;
    

    C++ variables will be randomly assigned if not initialized

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 13:30:18

    ever must be initialized, otherwise it will be assigned a random value

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 13:30:18

    ever is not initialized to 0

    reply
    0
  • Cancelreply