Привет, поэтому я использую lib pdCurses и stringStream, чтобы вычислить и создать строку длиной 5 символов, которая представляет часы.Это показывает как 00:00, 0:00, 00.00 или 0.000.Однако, когда я запускаю свою функцию, я получаю исключение:что-то простое, как заявление if?и как я могу это исправить? Спасибо за любую помощь!=) Также вот моя функция:
//////////////////////////////////////////// Refresh ///////////////////////////
void Refresh()
{
for(int r = 0;r<nrows;r++)
{
move(r,0);
instr((char*)_contents[r].c_str());
} // make sure this works later
// Insert the current time;
enum{ time_loc_y= 24, time_loc_x= 10 };
long float time = myStopwatch.ElapsedTime();
string time_s= " ";
string min; ss << (int)time%60; ss >> min;
string sec; ss << (int)time/60; ss >> sec;
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
{
time_s.insert(1, min); // 0:00
time_s.insert(time_s.begin()+2, ':');
time_s.insert(4, sec);
}
}
else
{
ss.precision(2); ss << time; // 00.00
ss >> time_s;
}
}
else
{
ss.precision(3);
ss << time; // 0.000
ss >> time_s;
}
mvinstr(time_loc_y, time_loc_x, (char*)time_s.c_str());
refresh();
}; // end of function