atoi,atol,atof関数



コード

#include	<iostream>
#include	<cstdlib>

using namespace std;

void main()
{

	//文字列をint型に変換する。
	cout << atoi("20") << endl;
	cout << atoi("100/5") << endl;
	
	//文字列をlong型に変換する。
	cout << atol("50") << endl;
	cout << atol("1000/20") << endl;
	
	//文字列をdouble型に変換する。
	cout << atof("33.333") << endl;
	cout << atof("100/3") << endl;


	return;	
}
			


結果

20
100
50
1000
33.333
100
			


<戻る>

PC用眼鏡【管理人も使ってますがマジで疲れません】 解約手数料0円【あしたでんき】 Yahoo 楽天 NTT-X Store

無料ホームページ 無料のクレジットカード 海外格安航空券 ふるさと納税 海外旅行保険が無料! 海外ホテル