C语言如何把数字转成字符串

使用sprintf   头文件    #include

栗子

 

#include
#include
#include
#include
using namespace std;
int main() {
    double a = 0.5555;
    char s[20];
    sprintf_s(s, "%.6lf", a);
    cout << s;
    system("pause");
    return 0;
}

 

哈哈哈哈真的神器妈的

早知道用这个我就不会在字符串上吃这么多亏了

 

转载于:https://www.cnblogs.com/kazama/p/10876475.html

你可能感兴趣的:(C语言如何把数字转成字符串)