1 /* 2 atoi算法,要求完美版 3 有两种,一种是用longlong,一种是真用int 4 “” 5 " " 6 “-” 7 “+” 8 “ -23” 9 “ +23” 10 “12a" 11 "abc" 12 越界情况 13 */ 14 #include 15 ...
分类:
其他好文 时间:
2014-07-25 02:22:04
阅读次数:
353
#pragma once
#include <iostream>
#include <string>
using namespace std;
//itoa
//int ==> string
//10进制
string itoa(int nNum)
{
int nSize = 128;
char* pStr = new char[nSize];
memset(pStr,0,nS...
分类:
其他好文 时间:
2014-07-25 00:10:54
阅读次数:
251
http://acm.hnu.cn/online/?action=problem&type=show&id=12812需要注意的细节很多 唉 看了modiz的代码 写出来的 自己代码能力太弱了 模拟题 atoi的头文件是stdio.h 1 #include 2 #include 3 #inclu.....
分类:
其他好文 时间:
2014-07-21 23:31:02
阅读次数:
278
题目要求:将String字符串转换成数字,不能用java自带的方法转换字符串,要求自己写一个atoi(String s),如果输入的不是数字则返回0。 import java.util.Scanner;
/**
* Created by Dell on 2014/7/14.
*
* ...
分类:
编程语言 时间:
2014-07-21 10:34:55
阅读次数:
221
Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below and ...
分类:
其他好文 时间:
2014-07-21 08:36:32
阅读次数:
208
file/fileflags.c #include "apue.h"#include intmain(int argc, char *argv[]){ int val; if (argc != 2) err_quit("usage: a.out "); if ((val = fcntl(atoi(a...
分类:
其他好文 时间:
2014-07-18 23:28:24
阅读次数:
203
这次的题目很经典。
1、Hermite Polynomials
2、求两个整数最大公约数
3、ATOI
4、可变参数列表的使用
具体的题目在这里:
题目请见 http://download.csdn.net/download/wangpegasus/5701765
1、
int hermite(int n, int x)
{
if (n < 1)
{
return 1;...
分类:
其他好文 时间:
2014-07-18 22:05:09
阅读次数:
234
UCHAR recordlenthrecordlenth与整形int比较时不用atoi转换recordlenth。若转换出错3.lseek函数所需头文件:#include #include/*定义了off_t,pid_t等类型*/函数原型:off_tlseek(intfd,,off_toff...
分类:
其他好文 时间:
2014-07-16 19:02:58
阅读次数:
282
把字符串转换为整数 代码(C)本文地址: http://blog.csdn.net/caroline_wendy题目: 写一个函数StrToInt, 模拟atoi的功能, 把字符串转换为整数.需要考虑异常处理, 正负数, 还有Int的最大值(0x7FFFFFFF)和最小值(0x80000000)等情况.代码:/*
* main.cpp
*
* Created on: 2014.7.12
...
分类:
其他好文 时间:
2014-07-16 13:43:13
阅读次数:
177
1.memcpy函数的原型: void* memcpy(void* dest,cosnt void* src,size_t n); 返回值:返回dest; 功能:从源内存地址src拷贝n个字节到dest内存地址. 这里必须要求源地址的内存和目标地址的内存没有覆盖,如果有覆盖结果是未定义的.#incl...
分类:
编程语言 时间:
2014-07-14 21:41:00
阅读次数:
274