这个vc程序这样写对吗?在线等解答。

来源:百度知道 编辑:UC知道 时间:2024/07/08 03:01:41
#include"iostream.h"
int main()
{
float a,b,c;
char oper,opee;
cout<<"请输入一个表达式(eg.1+2*3):"endl;
cin>>a>>oper>>b>>opee>>c;
if(oper=='+' && opee=='+')
{
cout<<a<<oper<<b<<opee<<c'='a+b+c<<endl;
}

return 0;
}
如果不对应该怎么改?

改成这样了

#include"iostream.h"
int main()
{
float a,b,c;
char oper,opee;
cout<<"请输入一个表达式(eg.1+2*3):"<<endl;
cin>>a>>oper>>b>>opee>>c;
if(oper=='+' && opee=='+')
{
cout<<a<<oper<<b<<opee<<c<<"="<<a+b+c<<endl;
}

return 0;
}