If you are going to call this function many times, this is probably not what you are looking for, because this is not the best way to do this, but it works.
Something along the lines of:
string text = to_string(55); if (text.find(".") != std::string::npos) { cout << "No digit added after decimal point" << text; } else { cout << "Digit added after decimal point" << text << ".0"; }
source share