// This program is based on the. NET platform and the compiling environment is Microsoft Visual C ++. net.
// To modify the VC ++ 6.0 platform, you only need to replace stdafx. h with iostream. h, and then remove the "using namespace STD" in the main function"
# Include "stdafx. H"
# Include "math. H"
Using namespace STD;
Double du, DV;
Void solu_w (double B, double C)
{
Double TEM, tem1;
Tem1 = B * B-4 * C;
Double M, N;
M = (-1) * B/2;
If (tem1> = 0)
{
TEM = SQRT (tem1 );
N = TEM/2;
Cout <"/n equation root: "<'/N' <"/T X1 = "<m + n <'/N' <"/T X2 = "<m-n <<Endl;
}
Else
{
TEM = SQRT (-1) * tem1 );
N = TEM/2;
Cout <"/n equation root: "<'/N' <"/T X1 = "<m <" + "<n <" I "<'/N' <" /t X2 = "<m <"-"<n <" I "<'/N' <Endl;
}
}
Void get_du_dv (double A, double B, double C, double D, double E, double F)
{
DV = (B * D-A * E)/(C * E-B * F );
Du = (C * D-A * f)/(B * F-C * E );
}
Void main ()
{
Cout <"coefficients of the input four equations" <Endl;
Double A [5];
Double temp;
For (int t = 4; t> = 0; t --)
{
Cout <"/t a [" <t <"] = ";
Cin> temp;
A [T] = temp;
}
Cout <"/n equation:/n/t" <A [4] <"(x) + "<A [3] <" (x) + ";
Cout <A [2] <"(x * x) +" <A [1] <"(X) + "<A [0] <" = 0 "<'/N' <Endl;
Double U, V;
Cout <"constant and one-time coefficient of input factor:" <Endl;
Cout <"/t u = ";
Cin> U;
Cout <"/T v = ";
Cin> V;
Cout <"/N factor formula:/n/t w (x) =" <"(x * x) +" <u <"(X) + "<v <Endl;
Double P0, P1, P2, R0, R1;
Cout <"/N input correction times :";
Int count1;
Cin> count1;
For (count1; count1> = 0; count1 --)
{
P2 = A [4];
P1 = A [3]-u * P2;
P0 = A [2]-V * p2-u * P1;
R0 = A [1]-V * p1-u * P0;
R1 = A [0]-V * P0;
// The following line is added to the program, causing the problem: if the number of corrections is too large, the program running time is greatly extended, and the main time is consumed on the screen.
// Cout <"/t p (x) =" <P2 <"(x * x) +" <P1 <"(X) + "<P0 <" = 0 "<Endl;
Double PP3, PP2, PP1, pp0, r0v, r1v, r0u, r1u;
PP3 = (-1) * P2;
PP2 = (-1) * P1;
PP1 = (-1) * P0;
Pp0 = 0;
R0v = u * P2-P1;
R1v = V * p2-p0;
R0u = r1v-u * r0v;
R1u = (-1) * V * r0v;
Get_du_dv (r0, r0u, r0v, R1, r1u, r1v );
U = u + du;
V = V + DV;
}
Solu_w (u, v );
}