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

這樣就能正常輸入了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM