if条件不进行判断,只执行a=m的语句
电脑知识爱好者互联网本站整理2007-9-5 0:32:57
知识重点:#include iostream.h void main() { char a; cout你的性别endl; cina; if(a=m) { int b; coutxendl; cinb; coutxbxendl; } else if(a=f) { int c; coutxendl; cinc; coutxc..
#include <iostream.h> void main() { char a; cout<<"你的性别"<<endl; cin>>a; if(a='m') { int b; cout<<"x"<<endl; cin>>b; cout<<"x"<<b<<"x"<<endl; } else if(a='f') { int c; cout<<"x"<<endl; cin>>c; cout<<"x"<<c<<"x"<<endl; } else { cout<<"x"<<endl; cout<<"x"<<endl; cout<<"0"<<endl; } cout<<"感谢您参与本权威测试"<<endl; cout<<"祝您愉快!"<<endl; } 你的条件判断语句全都写错了。a=应写成a==。前者是赋值符号,默认返回值为真,后者才是判断符号。
参与评论- 相关内容
- 最近更新
- ·用手机登陆qq,只是挂,不发信息..
- ·motorola L71的使用
- ·nikia的电池发胀还能够用吗?有没..
- ·pop-port接口能插数据线吗
- ·手机上网后被乱扣钱
- ·手机电池没充好,只充了两格电,..
- ·手机的缓冲储存器是什么?
- ·三星U608的照相功能怎么不能启用..
- ·诺尼亚7500能挂Q吗?
- ·手机没费了怎么办?
添加到百度搜藏