【问题标题】:VSCode on Mac doesn't take inputs, shows "cmdand cmdand quote>" insteadMac 上的 VSCode 不接受输入,而是显示“command command quote>”
【发布时间】:2021-07-24 04:04:30
【问题描述】:

我使用 Visual Studio 代码进行编码比赛并为此进行练习,我必须做一些问题,这些问题需要我输入某些内容并获得该内容的输出。 问题是,每当我运行代码(顺便说一下是 C++)时,终端只会显示:cmdand cmdand quote> 并且每当我输入一些内容并按 Enter 时,它都会换行并说同样的话。有谁知道我的电脑是不是有问题?还是别的什么?

编辑:为了回应 Alan Birtles,这是我能做的最短的。

#include <iostream>
#include <string>
using namespace std;

int main()
{
    int N;
    cin >> N;
    string winner, person;
    int max_bid = 0, bid;
    for(int i = 0; i < N; i++)
    {
        cin >> person;
        cin >> bid;
        if (bid > max_bid)
        {
            max_bid = bid;
            winner = person;

        }
    }
    cout << winner << endl;

}

这是为了解决这个问题:https://dmoj.ca/problem/ccc21j2 我不知道具体该如何解释,但是当我按下三角形运行按钮时,会出现以下内容:Terminal Image after run attempt

【问题讨论】:

  • 请出示minimal reproducible example,您要运行什么代码?你是怎么编译的?你是如何尝试运行它的?
  • @AlanBirtles 检查最新更新。不确定我如何编译它是什么意思。你能详细说明一下吗?
  • 您输入正确吗?完整输入给定的测试用例并告诉发生了什么
  • @risingStark 它不允许您输入任何内容。如果您输入任何内容并按回车键,它只会在开头使用相同的“cmdand cmdand quote>”进入一个新行。
  • 你的编译器命令看起来很奇怪,我猜你用来创建的任何东西都无法处理文件名中的空格

标签: c++ visual-studio-code


【解决方案1】:

enter image description here

enter image description here

嗨,哥们,我也遇到了同样的问题。 首先需要查看文件名,我的文件名“Hello's-world.c”就是这个问题发生之前的问题。

如果不是文件名,检查VSCode的C/C++文件,卸载重装,或者检查本单元安装的GCC版本!请原谅我的垃圾英语,我用的是谷歌的翻译!或许能帮到你!

【讨论】:

    猜你喜欢
    • 2020-03-18
    • 2023-02-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-15
    • 2019-07-07
    • 2022-11-23
    • 2013-11-19
    相关资源
    最近更新 更多