![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ACM
风筝_
这个作者很懒,什么都没留下…
展开
-
zoj_2886
题目:zoj_2886题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1885答案代码:#include <bits/stdc++.h>using namespace std;string covtostr(int d) //将int转化成string类型的函数{ ostrin...原创 2018-08-09 09:59:44 · 139 阅读 · 0 评论 -
C++string和数值类型的转化
本文讲解string类型和其他数据类型的转化,以int类型为例。有时候,string对象与数值之间需要相互转换,下面这个例子详细说明了如何完成这项工作。#include <iostream>#include <string>#include <sstream>using namespace std;//C++方法:将数值转换为strings...原创 2018-08-09 10:46:55 · 223 阅读 · 0 评论 -
C++输入一行字符串
C++编程中,一般在输入方面都是使用cin。而cin是使用空白来定字符串的界的。这就导致了对于带有空格的字符串,只能读取第一个空格之前的部分,比如字符串“I LOVE YOU”,只能读入“I”,后面的都无法读入。下面来解决这个问题,首先分成两种情况:字符数组和string类。对于字符数组:方法一:getline()读入整行数据,它使用回车键输入的换行符来确定输入结尾。调用方法: c...转载 2018-08-09 11:45:51 · 23340 阅读 · 1 评论