当我使用c ++字符串在我的代码它编译,但我不显示输出 [英] when i use the c++ string in my code it compiles but i don't show an output

查看:127
本文介绍了当我使用c ++字符串在我的代码它编译,但我不显示输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道我是否安装了 cygwin 错误或什么,但代码编译正常,但它不显示输出。这是我的代码:

I don't know whether I have installed cygwin wrong or what but the code compiles fine but it doesn't show the output. Here's my code:

#include <iostream>
#include <string>

using namespace std;

int main(int argc, char *argv[]) 
{
    string name;
    cout << "Enter the name of the person" << endl;
    getline(cin, name);
    cout << "Name is: " << name << endl;
    return 0; 
}

这里是编译图像和执行:

Here's the compilation image and the execution:

推荐答案

如我所见,您使用 cygwin 。我有同样的问题与 gcc 5.2 。尝试安装 gcc 4.9 以及此版本的所有相应库。

As I can see, you use cygwin. I had the same issue with gcc 5.2. Try to install gcc 4.9 and all corresponding libraries for this version instead.

这篇关于当我使用c ++字符串在我的代码它编译,但我不显示输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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