我可以将任何文本写入输入框,我的IDE是Visual Studio代码

发布于 2025-02-07 06:58:01 字数 209 浏览 1 评论 0原文

#include<iostream>
 
using namespace std;

int main() {
    string name;
    cout << "enter your name   : ";
    cin >> name;
    cout << name;    
} 
#include<iostream>
 
using namespace std;

int main() {
    string name;
    cout << "enter your name   : ";
    cin >> name;
    cout << name;    
} 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

醉城メ夜风 2025-02-14 06:58:01

您的错误可能不在代码中,但请确保您正确编译了程序。使用Visual Studio代码(假设您正在使用G ++编译器)时,请转到您的终端并输入:

g++ yourprogramname.cpp

这将用G ++编译文件,并将产生一个名为“ A.Exe”或“ A.Out”的文件在您的操作系统上。

要运行程序,请键入“。”,然后键入您的可执行文件名称:

.\yourprogrogramname.exe

这将运行您刚创建的程序,允许您输入名称。如果您仍然遇到问题,请尝试通过单击“ Visual Studio Code终端”中的“+”旁边的下拉菜单,或以管理员的身份运行VSCODE。

Your error may not be in your code, but ensure you are compiling your program properly. When using visual studio code (assuming you are using the g++ compiler), go to your terminal and type in:

g++ yourprogramname.cpp

This will compile the file with g++, and will produce a file named "a.exe", or "a.out" depending on your operating system.

To run your program, type ".", and then the name of your executable:

.\yourprogrogramname.exe

This will run the program that you just created, allowing you to then input the name. If you are still having problems, try using a different terminal by clicking the dropdown menu right next to the "+" in the Visual Studio Code terminal, or running VSCode as an administrator.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文