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

使用sprintf   头文件    #include<stdio.h>

栗子

#include<iostream>
#include<iomanip>
#include<stdlib.h>
#include<stdio.h>
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