atoi重写
来源:互联网 发布:ih5制作软件 编辑:程序博客网 时间:2024/05/01 23:51
#include <stdio.h>
#include <ctype.h>
int myAtoi(char * src);
int mian()
{
int result;
char str[50]={};
scanf("%49[^\n]s",str);
result = myAtoi(str);
printf("转换的值是:%d\n",result);
return 0;
}
int myAtoi(char * src)
{ int i = 0 ,tmp ,result =0;
int flag = 1;
while (*src <= ' ')//去掉不可见字符
++src;
if(*src == '-'){
++src;
flag = -1;
}
for (i = 0;isdigit(src[i]); ++i) {
tmp = src[i] -'0';
result = result * 10 +tmp;
}
result *= flag;
return result;
}
0 0
- atoi重写
- atoi函数重写
- atoi函数的重写
- atoi
- atoi
- atoi
- atoi()
- atoi
- atoi
- atoi
- atoi
- atoi
- atoi
- atoi
- atoi
- atoi
- atoi
- atoi
- Devexpress Spreadsheet 中文教程(3)
- Android中实现局部的图片滑动指引效果
- Android-自定义Dialog
- 图像处理优化思考一
- JavaScript学习笔记(一):Basic Knowledge
- atoi重写
- 正则表达式在iOS中的运用
- Objective-C Block详解
- 代码:求ax²+bx+c=0的解
- CharSequence与String的区别
- java.util.ConcurrentModificationException 解决办法
- NDK入门教程之配置环境,Hello-JNI,批量处理,多编译文件,面向多CPU架构
- 常用调试方法 DEBUG宏
- 机器人运动学中李代数se(3)与李群SE(3)的基本概念与联系