菜鸟问个问题,大家帮忙啦
#include<iostream>#include<conio.h>
using namespace std;
int main(int argc,char *argv[])
{
int nAddend=0,nSummand=0;
cout<<"Hello Console!\n--------\n";
char chTemp=0;
while(chTemp<'0'||chTemp>'9')
{
cout<<"请输入加数:";
chTemp=getch();
}
cout<<chTemp;
nAddend=chTemp-'0';
while(chTemp<'0'||chTemp>'9')
{
cout<<"请输入加数:";
chTemp=getch();
}
cout<<chTemp;
nSummand=chTemp-'0';
cout<<nAddend<<nSummand<<nAddend+nSummand;
system("pause");
return 0;
}
编译能通过,但不是显示两个数的和,帮忙看下哪错了,我在家自学,以后会常来此论坛,希望大家多多关照,谢谢啦