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引入的新功能,旧版本编译器可能不支持它,所以要给编译器 ...
随机推荐
- php基础之gd图像生成、缩放、logo水印和简单验证码实现
gd库是php最常用的图片处理库之一(另外一个是imagemagick),可以生成图片.验证码.水印.缩略图等等.要使用gd库首先需要开启gd库扩展,windows系统下需要在php.ini中将ext ...
- 开发unity DLL插件
最近开发一款设备的SDK,想着要开发unity版本,怎么做呢?首先想到的就是在外部编写相关的驱动程序然后集成成几个dll作为unity的SDK使用了.So,我就开始了unity外部插件的研究之旅了. ...
- git版本控制管理实践-3
git -m 和git -a -m(-am) . 的区别? usally two steps to commit files to respository: first, git add somefi ...
- python 学习 : 一个简单的秒表
游戏说明:绿色数字(左边表示成功停止在整秒的次数,右边表示停止的总次数) 点击stop,如果小数点后为0,即你停止的时间是整秒数,右上方斜杠左边数字加一 把代码复制到这个网页code run he ...
- ASP.NET 系统对象 Request(一)
Request对象 用来获取客户端在请求一个页面或传送一个Form是提供的所有信息.它包括用户的HTTP变量.能够识别的浏览器.存储客户端的Cookie信息和请求地址等. Request对象是Syst ...
- block要掌握的东西
/* block要掌握的东西 1> 如何定义block变量 int (^sumBlock)(int, int); void (^myBlock)(); 2> 如何利用block封装代码 ^ ...
- mysql登录报错“Access denied for user 'root'@'localhost' (using password: YES”的处理方法
使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码: 文件内容: [client]host = localhostuser = debian-sys-maint ...
- svn清除已保存的用户名和密码
在项目中使用SVN是必须的,我们一般将用户名和密码进行保存处理,这样做的好处在于每次都不用输入了,方便快捷.但是当我们想用另外一个svn账号时,这时候该怎么办呢,看下图,让提示框重新出来. 找到这个页 ...
- Linux进程间通信(九):数据报套接字 socket()、bind()、sendto()、recvfrom()、close()
前一篇文章,Linux进程间通信——使用流套接字介绍了一些有关socket(套接字)的一些基本内容,并讲解了流套接字的使用,这篇文章将会给大家讲讲,数据报套接字的使用. 一.简单回顾——什么是数据报套 ...
- CentOS6.3 编译安装LAMP(3):编译安装 MySQL5.5.25
所需源码包: /usr/local/src/MySQL-5.5.25/cmake-2.8.8.tar.gz /usr/local/src/MySQL-5.5.25/mysql-5.5.25.tar.g ...