getline:未找到标识符 [英] getline: identifier not found

查看:567
本文介绍了getline:未找到标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 getline()的问题。

我尝试了很多例子,并阅读其他解决方案,但这没有解决我的问题。我还有信息'getline:identifier not found'
我包括
< stdio.h> < tchar.h> < iostream> < conio.h> < stdlib.h> < fstream> ,但仍然没有。

I have problem with getline().
I tried many examples and read other solutions, but that didn't solve my problem. I still have info 'getline: identifier not found'. I included <stdio.h> <tchar.h> <iostream> <conio.h> <stdlib.h> <fstream> and still nothing.

#include "stdafx.h"

using namespace std;

int main(int argc, _TCHAR* argv[])

{

 string line;
 getline(cin, line);
 cout << "You entered: " << line << endl;

}    

我现在需要做什么?我使用Win7 64位,MSVS2013。

What do I need to do now? I use Win7 64bit, MSVS2013.

推荐答案

这应该修复:

#include "stdafx.h"
#include <iostream>
#include <string>

using namespace std;

int main(int argc, _TCHAR* argv[]){
   string line;
   getline(cin, line);
   cout << "You entered: " << line << endl;
}

这篇关于getline:未找到标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆