编辑代码

#include <iostream>
#include <sstream>
#include <iomanip>
#include <>
using namespace std;

string ModifyTolValue(string& text, int decimal_num)
{
    double temp = std::stod(text);
    std::stringstream ss;
    ss << std::setiosflags(std::ios::fixed) << std::setprecision(decimal_num) << temp;
    return ss.str();
}

bool IsDoubleString(const string& s)
{
    char* end = 0;
    double val = strtod(s.c_str(), &end);
    return end != s.c_str() && *end == '\0' && val != HUGE_VAL;
}

int main() {
    //JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。 
    string text = "33";
    int decimal_num = 2;

    string modified_text = ModifyTolValue(text, decimal_num);
	cout << modified_text << endl;
	return 0;
}