Any questions?
Reply Back New Topic
View Topic

如何分类 1007

1007 浏览:228 回复:2 赞:15 Started by Xawd 5 months ago

include<iostream>

include<cstdio>

using namespace std;
int main()
{

double a,b,x;
cin>>a>>b;
if(a!=0)
{
    if(b!=0)
    x=-b/a;
    else
    x=0;
    printf("%.4lf",x);
}
else cout<<"Input Error";
return 0;

}

View Replies

Replied by cheung 4 months ago 赞:3

if(a==0&&b!=0)cout<<"Input Error"<<endl;
else x=(0-b)/a;
printf("%.4lf",x);

0.00不用考虑 最后会这种情况也会输出0.0000,ab都为0不存在,因为题目说了没有这组数据


Replied by JasonLou 4 months ago 赞:2

厉害