c++ - 编译时不包含所有头文件并提供输出
问题描述
我一直在尝试使用 Visual Studio 来运行我的 C++ 代码,但我找不到解决方法。我遇到了这个名为C/C++ Compile Run的扩展,它使用起来很简单。我还使用标准的C/C++ Microsoft Extension。
然后我通过运行以下代码进行了尝试:
#include<iostream>
using namespace std;
int main(){
cout<<"hello";
char x[10];
cout<<"\nEnter a string please: ";
gets(x);
puts(x);
}
我忘了包括stdio.h
,但使用 C/C++ 编译运行扩展成功编译的代码。它给出了这个输出:
hello Enter a string please: string string
但是,我没有包括stdio.h
. 有没有什么办法解决这一问题?或者我应该尝试另一种编译 C++ 代码的方法?
解决方案
推荐阅读
- c# - .NET Core 3.1 应用程序中的 Parallel.Invoke 等价物是什么?
- arrays - 如何在 SwiftUI 中使用 Dictionaris 创建一个数组,然后调用它们?
- azure-sql-database - 由于与备份存储帐户相关的错误,无法升级到 Azure SQL 的超大规模层
- javascript - 无论如何 getSelection 方法忽略html标签
- ios - 如何在我的 Xcode 项目中集成 GigyaNss?
- java - 如何导入 UnionFind
到 IntelliJ?(爪哇) - r - 将闪亮的 DT 单元格值传递给函数
- sql - 使用 datform 增量更新表时出错
- python - 在 FileSystemLoader() 环境中,包含另一个 html 文件会引发 TemplateNotFound 错误,即使路径正确
- facebook - Facebook Graph Api:获取页面帖子评论的作者需要什么权限?