文字列配列 - >デジタルは税引後営業利益を達成

免責事項:この記事はブロガーオリジナル記事です、続くBY-SAのCC 4.0を著作権契約、複製、元のソースのリンクと、この文を添付してください。
このリンク: https://blog.csdn.net/IWantPlayYasuo/article/details/102756596
int Myatoi(const char *str)
{
	assert(str != NULL);
	if(str == NULL)
		return 0;
	int tmp = 0;
	int flg = 1;//符号
	while(*str == ' ')//开头空格
		str++;
	if(*str == '-')
	{
		flg = -1;
		str++;
	}
	if(*str == '+')
	{
		str++;
	}

	while(isdigit(*str))//"123"->
	{
		tmp = tmp*10+ (*str-'0');
		str++;
	}

	return flg*tmp;
}

おすすめ

転載: blog.csdn.net/IWantPlayYasuo/article/details/102756596