style: format code

This commit is contained in:
yanglbme
2019-08-21 10:10:08 +08:00
parent abc0d365de
commit 69ddc9fc52
101 changed files with 3154 additions and 2984 deletions

View File

@@ -1,49 +1,49 @@
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include <iostream.h>
#include <conio.h>
#include <math.h>
float eq(float i)
{
return (pow(i,3)-(4*i)-9); // origial equation
return (pow(i, 3) - (4 * i) - 9); // origial equation
}
void main()
{
float a,b,z,c,m,n;
float a, b, z, c, m, n;
clrscr();
for(int i=0;i<100;i++)
for (int i = 0; i < 100; i++)
{
z=eq(i);
if(z>=0)
z = eq(i);
if (z >= 0)
{
b=i;
a=--i;
b = i;
a = --i;
goto START;
}
}
START:
START:
cout<<"\nFirst initial: "<<a;
cout<<"\nSecond initial: "<<b;
for(i=0;i<100;i++)
cout << "\nFirst initial: " << a;
cout << "\nSecond initial: " << b;
for (i = 0; i < 100; i++)
{
float h,d;
m=eq(a);
n=eq(b);
float h, d;
m = eq(a);
n = eq(b);
c=((a*n)-(b*m))/(n-m);
a=c;
c = ((a * n) - (b * m)) / (n - m);
a = c;
z=eq(c);
if(z > 0 && z<0.09) // stoping criteria
z = eq(c);
if (z > 0 && z < 0.09) // stoping criteria
{
goto END;
}
}
END:
cout<<"\n\nRoot: "<<c;
END:
cout << "\n\nRoot: " << c;
getch();
}