VS Code 控制台不能输入

  • 问题

使用 VS Code 编写 C++ 程序时出现控制台不能输入的情况,代码如下:

#include<iostream>
using namespace std;
int main(){
    int a;
    cin>>a;
    cout<<a<<endl;
    return 0;
}

控制台提示 Cannot edit in read-only editor

  • 解决

我使用的是 Code Runner 扩展,设置里面 Run In Terminal 打勾就好了,步骤和图示如下:

File -> Preferences ->Setting -> Extensions -> Run Code configuration -> Run In Terminal

image-20200304203518324

这样就能正常输入了。

猜你喜欢

转载自www.cnblogs.com/aczarwang/p/12412029.html