In general, I encountered such a problem as entering a number in the console. So it turned out that the console displays the numbers is not quite correct as we would like.
or 
In pure Qt, I would stuff "input" into QString, and there I would have processed it. BUT std :: cin does not support QString. Of course, you can set char [256] and process it, but it has a finite size and this is very sad; _: because I want to do everything correctly , or better through char [256] and when reaching a char size of more than 256, tell the user that he has no right to drive a larger number ???
I would even say how to act in such situations ??
Here is the code, but it is not really about the question (just added for a tick):
int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); double A_d = 0; double B_d = 0; QTextStream outStream(stdout); outStream.setCodec(QTextCodec::codecForName("cp866")); outStream << QString("Введите первую сторону треугольника: \n А = ") << flush; while(!(std::cin >> A_d)){ outStream << QString("Ошибка ввода, пожалуйста введите число заново.") << flush; std::cin.clear(); std::fflush(stdin); } outStream << QString(" Мы тут !!! ") << flush; outStream << A_d << flush; return a.exec(); }
QString, I don’t know, although it seems strange to me that developers couldn’t write appropriate functions for it ... But who prevents to work withstring? Why at once extreme -char[]? - Harry