腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(9999+)
视频
沙龙
1
回答
std
::
getline
(
std
::
cin
,
string
)
从
键盘输入
失败
的
方法
、
、
:
string
Input;
std
::
string
Input; while (
std
::
getline
(
std
::
cin
, Input) &&
浏览 16
提问于2019-02-09
得票数 3
回答已采纳
2
回答
getline
()和输入流
的
问题
、
、
、
码int main() char s[20];
std
::cout<<"x"<<s<<"x"<<"\n";
std
::
cin
>>ch;
std
::cout<&
浏览 0
提问于2021-06-09
得票数 2
回答已采纳
1
回答
C++流
从
输入写入文件,每个单词后面没有新行
、
、
、
用户必须将输入,即将写入文件中
的
内容。problem是,每个单词都有一个新
的
行,即使它是在同一行中编写
的
,同时执行输入。但我希望它是用户输入
的
方式。void Log_Write::WriteInLog(
std
::
string
LogFileName) system("cls");
std
()<<"\n"; /
浏览 5
提问于2022-06-17
得票数 1
回答已采纳
5
回答
从
用户获取字符串中多个单词
的
代码
、
、
实际上,我希望用户输入一行字符串,其中包含多个单词,例如“我
的
名字是ABC”。用于此目的
的
C/C++代码是什么? 提前感谢
浏览 3
提问于2011-01-28
得票数 4
3
回答
在第一次用户输入之后,此代码将无法工作。
#include <iostream> { cout << "Please enter your full name: "; //gets property val
浏览 3
提问于2016-02-18
得票数 2
回答已采纳
3
回答
检查
string
::
getline
中
的
eof
、
、
如何使用
std
::
getline
函数检查文件结尾?如果我使用eof(),它不会向eof发出信号,直到我尝试读取文件结尾以外
的
内容。
浏览 4
提问于2010-02-12
得票数 46
2
回答
当空行遇到输入时停止接受输入
、
、
输入格式: Akash 45 int m;vector<pair<
string
,int>>player;int score;{ if(name.empty())
cin
>>score; player.push_back(make_pair(
浏览 6
提问于2020-06-09
得票数 1
回答已采纳
2
回答
std
::
getline
(
std
::
cin
,custom_class);类型不匹配
、
、
、
这是我
的
自定义字符串类(xstring.hpp):#include <sstream> { xstring_base<strT>(strT);}typedef xstring_base<<e
浏览 3
提问于2012-03-06
得票数 0
回答已采纳
2
回答
CIN
不耳目一新?
首先,我知道题目不清楚,所以,让我解释一下我
的
问题。#include <windows.h> SetConsoleTitle(" "); int x;
浏览 0
提问于2021-12-02
得票数 0
8
回答
std
::
cin
输入带空格?
、
、
、
、
#include <
string
>
std
::
cin
>> input;我实际上是用结构来做这件事
的
,而
cin
.
getline
似乎不起作用。下面是我
的
代码: s
浏览 2
提问于2011-04-30
得票数 187
回答已采纳
5
回答
std
::
cin
.
getline
( )与
std
::
cin
、
、
什么时候应该使用
std
::
cin
.
getline
()?它与
std
::
cin
有什么不同
浏览 3
提问于2011-01-20
得票数 40
回答已采纳
5
回答
如何在C++中清空输入流?
、
我希望下面的代码是安全
的
,但是在向输入提供一个字符串甚至字符之后,程序挂起了。如何读取包含\n
的
输入流以释放它?int main() { do {
std
::
cin
>> num; while(
std
::
cin
.get() !
std
::
cin
.good() || num > 5
浏览 0
提问于2012-12-20
得票数 3
回答已采纳
2
回答
cin
std
::字符串与空格
、
、
、
我想从
std
::
string
中读取一个名为destination
的
std
::
cin
,直到给定
的
分隔符。默认情况下,当我执行
std
::istream::operator<<时,destination <<
std
::
cin
会在空格后中断。如果destination是char[],我可以使用
std
::
getline
。 我们用于
std
::
string</e
浏览 0
提问于2018-05-16
得票数 1
回答已采纳
1
回答
cin
有时挂起,有时在输入无效后会永远重复。
// figure 1do {
std
::cout<<"s = ";
std
::
cin
.ignore(
std
浏览 4
提问于2014-07-16
得票数 0
回答已采纳
1
回答
反转字符串错误?
、
、
#include <iostream>using namespace
std
; { cout<<"%continue and 0 to exit"<<endl<<endl; if(inputa!=0) {
string</e
浏览 1
提问于2012-08-30
得票数 1
回答已采纳
4
回答
用户输入(
Cin
)-默认值
、
int number;
cin
>> number; // ...cout << "The number is: " << number << endl;
浏览 1
提问于2012-04-25
得票数 6
回答已采纳
7
回答
使用
getline
代替
cin
>>
嘿,伙计们,我
的
程序如下所示,但当我输入一个以w,d,b,或q开头
的
单词,例如,存款,而不是字母d,程序就会一直重复最初
的
问题,“你想取款吗,存款等等?”我试图将
cin
>>转换为
getline
(
cin
,user_request),但这给了我一个错误。我非常确定解决这个问题
的
方法
是将
cin
转换为
getline
,但我不确定如何正确地进行。有没有办法用
cin
语句来完成这个程序呢?#inclu
浏览 0
提问于2011-02-01
得票数 2
3
回答
流对象来表示文件输入,然后表示标准输入?
、
、
因此,我需要一种
方法
来封装表示文件内容
的
对象,然后在读取完该文件之后再封装
std
::
cin
--基本上将文件
的
内容放在标准输入
的
前面。(
std
::
getline
(file, line))
std
::
getline
(
std
::
cin
, line); return
std
浏览 4
提问于2017-07-15
得票数 1
回答已采纳
3
回答
C++循环I/O问题
、
) to profile: ";
std
::
cin
>> command; Process::create(true, command);} 这应该不是一个困难
的
浏览 2
提问于2014-04-27
得票数 1
1
回答
cin
.
Getline
不返回任何内容
、
、
我已经编写了这个简单
的
方法
,它应该要求输入一个字符串,然后返回它。为此,我使用了
cin
.
getLine
()
方法
,但是在使用
cin
.
getLine
()之后,字符串没有打印出来。
string
getString(char
string
[])
cin
>> <
浏览 0
提问于2013-03-27
得票数 1
回答已采纳
点击加载更多
热门
标签
更多标签
云服务器
ICP备案
腾讯会议
云直播
对象存储
活动推荐
运营活动
广告
关闭
领券