我可以将任何文本写入输入框,我的IDE是Visual Studio代码
#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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的错误可能不在代码中,但请确保您正确编译了程序。使用Visual Studio代码(假设您正在使用G ++编译器)时,请转到您的终端并输入:
这将用G ++编译文件,并将产生一个名为“ A.Exe”或“ A.Out”的文件在您的操作系统上。
要运行程序,请键入“。”,然后键入您的可执行文件名称:
这将运行您刚创建的程序,允许您输入名称。如果您仍然遇到问题,请尝试通过单击“ 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:
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:
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.