作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我是编程新手,这是我的第二个作业。它应该接受用户的输入,直到他们输入 |
退出程序。我做错了什么?
int main()
int i = 0;
char a = 0;
while ( a != "|" ){ //has also told me this is an
// invalid operator
int numeric;
cout << "Give character: ";
cin >> a ;
cout << "Its ascii value is: " << (int) a << endl;
++i;
}
}
这里是错误:
2 IntelliSense: operand types are incompatible ("char" and "const char *")
最佳答案
不要使用"|"
。改用 '|'
。您想将 char
与 char
进行比较,而不是将 char
与 char*
进行比较。
关于C++ Basic while循环,击键退出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28467510/
menu Home Events Technical Schedule
我试图阻止触发默认 anchor 链接和 onclick 事件。 这是 HTML 代码: Google 我正在尝试使用以下 jQuery 代码阻止任何重定向的发生: $("#mylink").cli
我想在单击父 div 上的任意位置时切换我的 div,除非单击 anchor 元素。因此,例如,如果我单击示例中的第一个文本,我希望它切换,但在我的示例中的第二个文本上,我不希望它切换。 JSFidd
我在通过 jQuery 伪造 anchor 点击时遇到问题:为什么我的thickbox在我第一次点击输入按钮时出现,但第二次或第三次却没有出现? 这是我的代码: Link 当我直接点击链接时,它总是
我已经从 Mootools 切换到 jQuery,因为我认为它有更好的支持。我有这样的 HTML: Opcje Opcje Opcje Opcje Opcje Opcje Opcje JS
我是一名优秀的程序员,十分优秀!