?? 解二維方程式.cpp
字號:
#include <iostream.h>
#include <iomanip.h>
#include <math.h>
int main(void)
{
cout.setf(ios::fixed,ios::floatfield);
cout.precision(3);
double a,b,c;
double X1,X2;
double disc;
double sq;
cin >>a;
cout <<"Enter a = " <<a <<"\n";
cin >>b;
cout <<"Enter b = " <<b <<"\n";
cin >>c;
cout <<"Enter c = " <<c <<"\n";
disc = b*b-4*a*c;
if (disc <0.0)
{
cerr <<"error" <<"\n";
return -1;
}
sq=sqrt(disc);
X1=(-b+sq)/2*a;
X2=(-b-sq)/2*a;
cout <<"The root value x1 =" <<X1 <<"\n";
cout <<"The root value x2 =" <<X2 <<"\n";
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -