to_string()的应用
作用是将数字转化为字符串
#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=;
int inf=-;
#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=;i<=;i++)
{
s+=to_string(i);
}
cin>>n;
one(s[n-]);
return ;
}
to_string()的应用的更多相关文章
- C++中的to_string()函数[C++11支持]
C++ -> 字符串库 -> std::basic_string 定义于头文件 std::string to_string(int value); (1) (C++11起) std::st ...
- c++中几种常见的类型转换。int与string的转换,float与string的转换以及string和long类型之间的相互转换。to_string函数的实现和应用。
1.string转换为int a.采用标准库中atoi函数,对于float和龙类型也都有相应的标准库函数,比如浮点型atof(),long型atol(). 他的主要功能是将一个字符串转化为一个数字,在 ...
- caffe中在某一层获得迭代次数的方法以及caffe编译时报错 error: 'to_string' is not a member of 'std'解决方法
https://stackoverflow.com/questions/38369565/how-to-get-learning-rate-or-iteration-times-when-define ...
- c++之to_string()函数
函数原型:string to_string (int val);string to_string (long val);string to_string (long long val);string ...
- C++11中的to_string
C++11之前,标准库没有提供数字类型转字符串的函数,需要借助sprintf.stringstream等,现在C++11提供了std::to_string函数,可以直接使用了: 点击(此处)折叠或打开 ...
- HDU 1013 Digital Roots(to_string的具体运用)
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1013 Digital Roots Time Limit: 2000/1000 MS (Java/Othe ...
- LeetCode - 412. Fizz Buzz - ( C++ ) - 解题报告 - to_string
1.题目大意 Write a program that outputs the string representation of numbers from 1 to n. But for multip ...
- 程设刷题 | 编译C++文件出现to_string is not a member of std 或者 to_string was not declared in this scope的解决方法
写在前面 原文链接:Enabling string conversion functions in MinGW C++在将整型.浮点型.长整型等数据类型转换为字符串时,可使用<string> ...
- error: ‘to_string’ was not declared in this scope
错误: error: ‘to_string’ was not declared in this scope 原因: to_string是C++11引入的新功能,旧版本编译器可能不支持它,所以要给编译器 ...
随机推荐
- 给网页 title添加图片。
在网页的title中添加 <link rel="shortcut icon" href="logo.png" /> 即可. 可以看下百度搜索的代码, ...
- 还原MySql数据库失败:max_allowed_packet 设置过小导致记录写入失败
MySQL根据配置文件会限制Server接受的数据包大小. 有时候大的插入和更新会受 max_allowed_packet 参数限制,导致写入或者更新失败. 查看目前配置 show VARIABLES ...
- dataTables 使用小细节
1.dataTables 日期查询 var row_content = []; //暂存表格的行内容 var rows=[]; //暂存表格行索引 /**将日期缓存添加,清除上一次日期搜索的缓存*/ ...
- php分页类
1.需求 学会php分页类的使用 2.参考例子 CI的分页类 3.代码部分 <?php class pagination{ public $pagesize=20; public $pagein ...
- MFCC特征提取(C语言版本)
音频分析中,MFCC参数是经典参数之一.之前对于它的计算流程和原理,大体上是比较清楚的,所以仿真的时候,都是直接调用matlab的voicebox工具或者开发的时候直接调用第三方库.最近想整理一个纯C ...
- Python: Win7下使用 pip install lxml 无法安装lxml?
1.在网址 http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml 下,搜索lxml,下载Python对应的lxml版本.如下图: 2.打开cmd,进入到lxm ...
- C#中将DataTable转成List
学习MVC的时候,使用List<T>来存储数据给前台,但是从数据库中直接读取得到的是DataTable,虽然可以直接循环DataTable来得到list,但是如果每个实体类都通过这样的得到 ...
- xml引用实体dtd不能成功的问题
你没有错,现在的浏览器都不怎么支持实体引用了,这是个无奈的现实.我记得上回试过,好像如果DTD不是单独的文件而是内置到XML里面的话,实体还可以显示的.你可以试一下 <?xml version= ...
- ionic扩展插件
1.ionic-timepicker 时间选择 https://github.com/rajeshwarpatlolla/ionic-timepicker 2.ionic-datepicker 日 ...
- href使用 javascript:;与javascript:void(0)防跳到顶部
有时候我们在编写js过程中,需要触发事件而不需要返回值,那么就可能需要这样的写法 href=”#”,包含了一个位置信息.默认的锚是#top,也就是网页的上端,当连续快速点击此链接时会导致浏览器巨慢 ...