c - 由于警告 C6031(“忽略返回值:'scanf'),Visual Studios 不会编译代码
问题描述
我很新,几周前才开始学习如何编码。我下载了 Visual Studio 并尝试将其用作编辑器和 C 编译器。我制作了一个程序并尝试编译它,但由于此 C6031(“忽略返回值:'scanf')警告,它不会。我尝试在 C 编译器上在线编译它并且它有效。不知道如何解决这个问题。 Visual Studios (v 2019) 有问题吗?这是我的代码。
#include<stdio.h>
#include<math.h>
int main(void)
{
// Define variables
double x, answer;
// Define the value we will find the sin of
printf("Enter a value for x between (0, 1): ");
scanf("%lf", &x);
// Calculate the sin of value
answer = sin(x);
if ((x >= 0) && (x <= 1)) {
// Display answer
printf("\nThe sine of %lf is %lf", x, answer); }
else
{
printf("Value is not within (0, 1) range.");
}
return 0;
}
解决方案
推荐阅读
- javascript - 在链接点击时触发一个功能(似乎有效,但不是在弹出窗口中)
- mysql - 如何在 MySQL 中按 json 对象排序
- python - 如何将 tkinter 类作为对象或在按钮单击中调用?
- unity3d - 如何放大和缩小并保持纵横比?
- c - 如何为open编写一个包装函数,它接受可变数量的参数?
- json - 如何在Angular 7中的Json序列化中添加类型信息
- c# - 在 Visual Studio for Mac 中添加 Web 引用
- android - 生成签名的 APK:构建 APK 时出错。您可以在“消息”视图中找到错误
- c# - 从 .net 中的已发布文件夹运行后,Quartz 调度程序无法正常工作
- spring-cloud-stream - Spring Cloud Aws kinesis Binder 组中的所有 JVM 以不同的时间间隔使用相同的消息