久久久久亚国产电影一|午夜日本永久乱码免费播放片|男女性高爱潮是免费国产|久久国产乱子伦精品视频免费

  • <td id="6yqwu"></td>
  • <td id="6yqwu"></td>
    <button id="6yqwu"><samp id="6yqwu"></samp></button>
  • C/C++中字符串與數(shù)字相互轉(zhuǎn)換

    悅辰

    首先我們找到Visual C++ 6.0,鼠標(biāo)雙擊,點(diǎn)開(kāi)

    C/C++中字符串與數(shù)字相互轉(zhuǎn)換

    接著,輸入頭文件:

    # include<stdlib.h>
    # include<stdio.h>

    C/C++中字符串與數(shù)字相互轉(zhuǎn)換

    我們調(diào)用itoa()函數(shù)把把整數(shù)num_int轉(zhuǎn)成字符串str_int

    調(diào)用gcvt()函數(shù)把浮點(diǎn)數(shù)num_dounle轉(zhuǎn)化成字符串str_double
    程序如下:
    int main(void)
    {int num_int=200;
    double num_double=425.10f;
    char str_int[30];
    char str_double[30];
    itoa(num_int,str_int,10);
    gcvt(num_double,8,str_double);

    C/C++中字符串與數(shù)字相互轉(zhuǎn)換

    最后我們輸出字符串str_int和字符串str_double,程序運(yùn)行,如圖所示

    printf("str_int:%sn",str_int);
    printf("str_double:%sn",str_double);
    return 0;
    }

    C/C++中字符串與數(shù)字相互轉(zhuǎn)換

    C/C++中字符串與數(shù)字相互轉(zhuǎn)換