首页 > 其他 > 详细

to_string()的应用

时间:2016-09-08 00:43:44      阅读:167      评论:0      收藏:0      [点我收藏+]

作用是将数字转化为字符串

#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<cstdlib>
#include<set>
#include<ctime>
#include<vector>
#include<cstdio>
#include<list>
using namespace std;
typedef long long ll;
int INF=2147483647;
int inf=-2147483648;
#define read(x) scanf("%d",&x);
#define fo(i,n) for(int i=1;i<=(n);i++)
#define me(a) memset(a,0,sizeof(a));
#define one(x) cout<<(x)<<endl;
#define two(a,b) cout<<(a)<<" "<<(b)<<endl;
int main()
{
    int n;
    string s;
    for(int i=1;i<=1000;i++)
    {
        s+=to_string(i);
    }
    cin>>n;
    one(s[n-1]);
    return 0;
}

 

to_string()的应用

原文:http://www.cnblogs.com/wangmenghan/p/5851353.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!