#include<iostream>
using namespace std;
int main()
{
int num = , j = , i = ;
char temp[], str[]; while (num)
{
temp[i] = num % + '';
i++;
num = num / ;
}
temp[i] = ;
printf("temp=%s\n", temp);
i = i - ;
printf("temp=%d\n", i);
while (i >= )
{
str[j] = temp[i];
j++;
i--;
}
str[j] = ;
printf("string=%s\n", str);
system("PAUSE");
return ;
}
#include<iostream>
using namespace std;
int main (void)
{
int num = ;
char str[];
itoa(num, str, );
cout<<num<<" "<<str;
return ;
}

itoa()函数有3个参数:第一个参数是要转换的数字,第二个参数是要写入转换结果的目标字符串,第三个参数是转移数字时所用的基数。在上例中,转换基数为10。10:十进制;2:二进制...

怎样将一个整数转化成字符串数,并且不用函数itoa的更多相关文章

  1. Python如何将整数转化成二进制字符串

    Python 如何将整数转化成二进制字符串 1.你可以自己写函数采用 %2 的方式来算. >>> binary = lambda n: '' if n==0 else binary( ...

  2. [LeetCode] Integer to Roman 整数转化成罗马数字

    Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 t ...

  3. 实现整数转化为字符串函数itoa()函数

    函数原型: char *itoa( int value, char *string,int radix);原型说明:value:欲转换的数据.string:目标字符串的地址.radix:转换后的进制数 ...

  4. 2407: C语言习题 整数转换成字符串

    2407: C语言习题 整数转换成字符串 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 917  Solved: 416[Submit][Status] ...

  5. [LeetCode] 12. Integer to Roman 整数转化成罗马数字

    Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 ...

  6. 将数据转化成字符串时:用字符串的链接 还是 StringBuilder

    /* 目的:将数据转化成字符串时:用字符串的链接 还是 StringBuilder呢? */ public class Test{ public static void main(String[] a ...

  7. Android--将Bitmip转化成字符串

    因为自己做的东西想要上传到服务器,所以就选择了将Bitmip转化成了字符串在上传 其它格式的图片我们好像可以用Bitmap.Factory 去将他们转化成BitMap 转化成字符串的代码 //将bit ...

  8. Javascript里,想把一个整数转换成字符串,字符串长度为2

    Javascript里,想把一个整数转换成字符串,字符串长度为2.  想把一个整数转换成字符串,字符串长度为2,怎么弄?比如 1 => "01"11 => " ...

  9. C#double转化成字符串 保留小数位数, 不以科学计数法的形式出现

      在C#中大家都会遇到这种情况 double类型的数据,需要格式化(保留N未有效数字)或者是保留N为小数等情况,我们往往采取double.tostring("参数");的方法.下 ...

随机推荐

  1. JavaEE Cookie HttpSession 学习笔记

    1. 会话管理概述 1.1 什么是会话 好比一次通话.打开浏览器,点击多次链接(发出多次请求和收到多次的响应),关闭浏览器,这个过程就是一次会话. 有功能 可以  文件 新建会话 1.2 解决的问题是 ...

  2. HUSTM 1601 - Shepherd

    题目描述 Hehe keeps a flock of sheep, numbered from 1 to n and each with a weight wi. To keep the sheep ...

  3. Mapreduce实验一:WordCountTest

    1.确定Hadoop处于启动状态 [root@neusoft-master ~]# jps 23763 Jps3220 SecondaryNameNode3374 ResourceManager293 ...

  4. POJ 1984 - Navigation Nightmare - [带权并查集]

    题目链接:http://poj.org/problem?id=1984 Time Limit: 2000MS Memory Limit: 30000K Case Time Limit: 1000MS ...

  5. ZOJ 2760 - How Many Shortest Path - [spfa最短路][最大流建图]

    人老了就比较懒,故意挑了到看起来很和蔼的题目做,然后套个spfa和dinic的模板WA了5发,人老了,可能不适合这种刺激的竞技运动了…… 题目链接:http://acm.zju.edu.cn/onli ...

  6. NLP-python 自然语言处理01

    # -*- coding: utf-8 -*- """ Created on Wed Sep 6 22:21:09 2017 @author: Administrator ...

  7. Ubuntu 14.04 使用速度极快的Genymotion 取代蜗牛速度的原生AVD模拟器

    Ubuntu 14.04 使用速度极快的Genymotion 取代蜗牛速度的原生AVD模拟器 2014-5-29阅读4045 评论0         默认的AVD的速度可谓奇慢无比,一番搜索最后找到了 ...

  8. hmm用于speech和image

    隐马尔科夫模型用于speech和image的原因是,因为hmm模型主要是适用于前后特征有关联性(参考骰子案例)的数据,有三种模式, 其中一种模式就是通过数据输出判断来源分类,而speech和image ...

  9. mac 10.12显示隐藏文件

    macOS Sierra 10.12版本 显示隐藏文件   1.显示隐藏文件 打开Terminal 输入:defaults write com.apple.finder AppleShowAllFil ...

  10. SQL SERVER - 谁更改了SQL登录密码?

    转自:https://blog.sqlauthority.com/2016/04/03/sql-server-changed-password-sql-login-interview-question ...