atoi函数实现
来源:互联网 发布:淘宝中奖客服电话 编辑:程序博客网 时间:2024/05/02 01:54
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>//atoi函数int str_int(const char* str){const char* ptr = str; //ptr保存str字符串开头int temp=0;if (*str == '-'||*str=='+'){str++;}while (*str!='\0'){if (*str < '0'&&*str > '9')break;temp = temp * 10 + (*str - '0'); //把单字符转换成整数str++;}if (*ptr == '-'){temp = -temp;}return temp;}void main(){printf("Please intput a number string: ");char str[10];scanf("%s", &str);int n = str_int(str);printf("\nOutput:%d ",n);system("pause");}
0 0
- atoi函数实现
- atoi,itoa函数实现
- atoi函数的实现
- atoi()函数的实现
- atoi函数实现
- atoi函数实现
- atoi函数实现
- atoi函数实现_buwanmei
- 实现atoi函数
- atoi函数实现
- atoi()函数的实现
- atoi函数的实现
- atoi函数的实现
- atoi函数实现
- atoi函数实现
- atoi函数实现
- atoi函数的实现
- atoi函数实现
- arcgis server之路网服务发布
- (赚)do while(0)的用法
- UIPickerView的常见属性
- linux下java部署
- 设计模式——工厂模式
- atoi函数实现
- OrderedDict 有序字典以及读取json串时如何保持原有顺序
- C++模板详解
- Why MVC is Better?(翻译)
- Struct passwd 和 struct spwd
- 开启大数据、云计算之旅
- C++中的try catch语句
- jndi作用
- 最短路算法合集