itoa , atoi ,sprintf 的用法
来源:互联网 发布:淘宝怎么卖眼药水 编辑:程序博客网 时间:2024/05/21 06:55
#include<cstdio>#include<iostream>#include<cstdlib>#include<windows.h>#define NN 4294967040using namespace std;int main(){ /* itoa(int,char[],n) --> 把int化为n进制 transfer to char[]*/ int a=127;char b[1000];itoa(a,b,2);int i=0; while(1) { if(b[i]=='\0') break; else cout<<b[i]; i++; } //输出为 1111111 cout<<endl; /* sprintf(char[],"格式控制符",int) --> 把int化为n进制 transfer to char[]*/ char c[1000];sprintf(c,"%x",a);i=0;while(1) { if(c[i]=='\0') break; else cout<<c[i]; i++; } //输出为 7f /* (int) atoi(char[]) --> char[] transfer to int */ int d;d=atoi(b);cout<<endl<<d; //输出为 1111111d=atoi(c);cout<<endl<<d; //输出为 7 (注意区别:转换到第一个非“数字(的字符)”) }
0 0
- itoa , atoi ,sprintf 的用法
- atof(),atoi(),itoa(),sprintf()等用法总结,强大的sprintf()
- atof(),atoi(),itoa(),sprintf()等用法总结
- atoi,itoa,sprintf等函数的实现
- itoa atoi sprintf
- itoa atoi sprintf
- atoi, itoa, sprintf and sscanf
- atoi, itoa, sprintf and sscanf
- atoi() 与 itoa()函数的用法
- itoa和atoi的用法及功能
- atoi 和itoa用法
- atoi 和itoa用法
- atoi 和itoa用法
- atoi 和itoa用法
- itoa 和 atoi 用法
- atoi 和itoa用法
- atoi 和itoa用法
- atoi 和itoa用法
- 欢迎使用CSDN-markdown编辑器
- Android 关于OOM的解决方案
- 第三十五讲项目4--贪财的富翁
- LoadRunner VuGen脚本增强之逻辑判断增强与事务
- 今天我们有1.25亿独立用户访问,只用了50毫秒——redis中setbit的使用
- itoa , atoi ,sprintf 的用法
- Hibernate—session与transaction
- iOS 开发 深入浅出Runtime运行时之官方指南翻译--runtime介绍
- 如何在Linux云服务器上搭建Xampp
- 初学结构体
- ZCMU—1067
- Parallel Reduction --- (2) Remove Unnecessary Modular Arithmetic
- Android系统源代码编译—[4]运行构建
- 最小割的一些性质和理解