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;
}

 

哈哈哈哈真的神器妈的

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

 

posted @ 2019-05-16 16:39  风间6324  阅读(11908)  评论(0编辑  收藏  举报