c - scanf() 被跳过并在 C++ 中嵌套代码
问题描述
我试图让 2 个单词进行比较,无论它们是否相同,但第 14 行的 scanf() 不起作用,代码直接打印“False”
#include <string.h>
#include <stdio.h>
int main()
{
int w1, w2; //word 1, word 2
{
printf("What is the first word?");
scanf("%%", &w1);
printf("What is the second word?");
scanf("%%", &w2); <--------line 14
{
if
(w1 == w2) {
printf("True");
}
else {
printf("False");
}
}
}
}
解决方案
推荐阅读
- laravel - 为特定值制作播种机
- android - 未解决的参考:向目的地添加了一些参数后的 NavArgs
- swift - 打印 MDLMesh 的顶点位置
- selenium - 方法 drag_and_drop_by 不起作用
- excel - 如何根据单元格的值搜索列并将相邻列的值添加到列表中?
- php - 从带有爆炸列的数据库返回产品列
- python - 在日志文件中搜索一个值直到它发生变化,然后对这些值进行分组和计数
- attributes - 树枝问题;如何使用树枝变量动态定义类(或任何属性)
- c# - 在 DatePicker 内更改颜色
- python - 如何处理仅在首次登录时出现的 EULA 弹出窗口?