Exception when comparing an (int)double and (int)int

前端 未结 3 1148
灰色年华
灰色年华 2021-01-27 10:36

Hey so i\'m using the pdCurses lib and stringStream to calculate and make a 5 character long string that represents a clock. It shows like 00:00, 0:00, 00.00, or 0.000. However

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-27 10:51

    I think you're mistaken about what's throwing the exception. Where is ss defined?

    NB if you reformat your code to a more canonical style, like

    if((int)time >= 10){    
        if((int)time >= 60){
           if((int)time >= 600){   
              time_s.insert(0, min);              // 00:00
              time_s.insert(time_s.begin()+2, ':');
              time_s.insert(4, sec);
           } else {
    

    with one statement per line, the exception will tell you much more closely which statement caused the problem.

提交回复
热议问题