Final Paper C++ Codes

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

LIST OF CODES cout<< "\t\t geometric objects -

points, lines, and circles being the


#include <iostream> most basic of these.\n";
#include <cmath> cout<< "\t\t Also called coordinate
#include <cstdlib> geomtery, mathematical subject in
#include <windows.h> which algebraic symbolism\n";
#include <sstream> cout<< "\t\t and methods are used
to represent and solve problems in
using namespace std; geometry.\n\n";

int main() cout<< " Input Methods: " <<


{ endl;
cout<< " [a]. Coordinates";
//choosing the type of method
cout<< "\t\t[b]. Equation" <<
char o, p, code, cond, yesno; endl;
float w, x, y, z, k, l, a, b, c, d, e, cout<< "\n";
f,m1, m2; cout<< " Please Enter The
Method: ";
cin >> o;
system("color 3e");
char h=219; //for the character to be cout<< "\n";
used in loading bar
cout<< "\n\n\n\t\t\t\t\tLoading..."; switch (o)
cout<< "\t"; {
for (int i=0; i<=30; i++) case 'a':
{cout<< h; cout<< " You have chosen to input
Sleep(150);} coordinate method, Continue?
cout<< "\r"; [Y]Yes/[N]No/[E]End: ";
cout<< "\t\t\t\t\t"; cin>> code;
{
if (code == 'y' || code == 'Y')
system("CLS"); goto cont1;
goto jump;
else if (code == 'n' || code
== 'N')
jump: {system("CLS");
cout<< " goto jump;}
\t\t\t\t\t~~~~~~~~~~~~~~~~~~
~~~~~~~~~~\n\n"; else if (code == 'e' || code
cout<< " \t\t\t\t\t Math 4 (Analytic == 'E')
Geometry)\n\n"; {cout<< " \n Thank
cout<< " You!\n\n";
\t\t\t\t\t~~~~~~~~~~~~~~~~~~ break;}
~~~~~~~~~~\n\n";
cout<< "\t\t --> Analytic else
Geometry is a branch of algebra that {cout << " \nWrong input
is used to model\n"; ";
break;} y:
} cout<< " --> y: ";
cont1: cin>> y;
cout<< "\n";
cout<< " Input the Coordinates: {
\n"; //statements if (cin.fail())
cout<< " Input Coordinate 1: {cin.clear();
(w,x)\n"; //statements cin.ignore();
w: cout<< "\n **Wrong input!
cout<< " --> w: "; Input number only.** \n\n";
cin>> w; goto y;}

{ else
if (cin.fail()) {
{cin.clear(); cin.ignore();
cin.ignore(); }
cout<< " \n **Wrong input! }
input number only.** \n\n";
goto w;} z:
cout<< " --> z: ";
else cin>> z;
{
cin.ignore(); {
} if (cin.fail())
} {cin.clear();
x: cin.ignore();
cout<< " --> x: "; cout<< "\n **Wrong input!
cin>> x; Input number only.** \n\n";
goto z;}
{
if (cin.fail()) else
{cin.clear(); {
cin.ignore(); cin.ignore();
cout<< "\n **Wrong input! }
Input number only.** \n\n"; }
goto x;} cout<< "\n Coordinate 2=
("<<y<<","<<z<<")";
else cout<< "\n";
{
cin.ignore(); cout<< "\n";
}
} proc:
cout<< " Process: \n";
cout<< "\n Coordinate 1= cout<< " [a]. Midpoint\n";
("<<w<<","<<x<<")"; cout<< " [b]. Slope\n";
cout<< "\n\n"; cout<< " [c]. Distance\n";
cout<< " Input Coordinate 2: cout<< "\n";
(y,z)\n"; cout<< " Input Process: ";
cin>>cond; k:
cout<< "\n"; cout<< " --> Input k: ";
cin>> k;
{
if (cin.fail())
if (cond == 'a' || cond == 'A') {cin.clear();
{cout<< " Midpoint= cin.ignore();
[(w+y)/2 , (x,z)/2]\n"; cout<< "\n Wrong input! Input
cout<< " Midpoint= "<< number only. \n\n";
(w+y)/2 << "," << (x+z)/2; goto k;}
cout<< "\n";
cout<< " do you want to else
continue? [Y]/[N]: "; {
cin>> code; cin.ignore();
{ }
if (code == 'y' || code == }
'Y') l:
{ cout<< " --> Input l: ";
cin>> l;{
system("CLS"); if (cin.fail())
goto jump; {cin.clear();
} cin.ignore();
cout<< "\n Wrong input! Input
else number only. \n\n";
cout<< " Thank You!"; goto l;}
break;
}} else
{
cin.ignore();
else if (cond == 'b' || cond == }
'B') }
{cout<< " Slope= (x-z)/(w-
y) \n"; cout<< "\n Slope is
cout<< " Slope= "<< x-z << "<<k<<"/"<<l;
"/" << w-y; cout<< "\n\n";
cout<< "\n\n";
cout<< " Given the cout<< " Angle between
computed slope, \n"; the two slopes: \n\n";
cout<< " Do you want to
enter another slope? [Y]Yes /[N]No & cout<< " angle= (m2-
start again /[E]End: "; m1)/(1+m2m1)\n";
cin>>code; cout<< " angle= " << (
cout<< "\n"; (l/k) - ((x-z)/(w-y)) )/(1+ (l/k)*((x-
{ z)/(w-y)));
if (code == 'y' || code ==
'Y') cout<< "\n\n";
{cout<< " Input Slope: cout<< " Is it Parallel or
k/l\n"; Perpendicular?\n\n";
cout<< " Given slopes: cout<< " Thank You!";
\n"; break;
cout<< " m1= "<< x-z }
<< "/" << w-y;
cout<< "\n";
cout<< " m2= "<< k << }
"/" << l;
{ else if (code == 'n' || code
== 'N')
m1 =(x-z)/(w-y); {
m2 =k/l; system("CLS");
goto jump;}
m1=m1;
m2=m2; else
cout<< " Thank You!";
if (m1==m2)
{cout<< "\n";
cout<< " ***The two
slopes are Parallel";} }
cout<< " Continue from the
else if (m1 == -1/m2) start? [Y]/[N]: ";
{cout<< "\n"; cin>>code;
cout<< " ***The two {
slopes are perpendicular";} if (code == 'y' || code ==
'Y')
else {system("CLS");
{cout<< "\n"; goto jump;}
cout<< " ***The two
lines are not Perpendicular nor else
Parallel";} cout<< " Thank You!";
break;
}}
}
else if (cond == 'c' || cond ==
cout<< "\n\n\n"; 'C')
{cout<< " Distance= sqrt[(y-
w)^2 + (z-x)^2] \n";
cout<< " Start again? cout<< " Distance= "<<
[Y]/[N]: "; sqrt(pow(y-w,2) + pow(z-x,2));
cin>> yesno; cout<< "\n";
cout<< " do you want to
{ continue? [Y]/[N]: ";
if (yesno == 'Y' || yesno cin>>code;
== 'y') {
{system("CLS"); if (code == 'y' || code ==
goto jump;} 'Y')
{system("CLS");
else goto jump;}
else if (code == 'e' || code ==
else 'E')
cout<< " Thank You!"; {cout<< " Thank You!";
break; break;}
}}
else
else cout << " Wrong input ";
cout<< " Wrong Input, break;
Continue? [Y]Yes /[N]No & Start Again }
/[E]End: ";
cin>> code; cont2:
{
if (code == 'y' || code == 'Y') cout<< "\n\n";
{goto proc;} cout<< " [1.] Linear: A(x^2) +/-
B(x) +/- C = 0 \n";
else if (code == 'n' || code == cout<< " [2.] Circle: A(x^2) +
'N') A(y^2) + Dx + Ey + F = 0 \n";
{system("CLS"); cout<< " [3.] Parabola (axis vertical):
goto jump;} A(x^2) + D(x) + E(y) + F = 0 \n";
cout<< " [4.] Parabola (axis
else if (code == 'e' || code == horizontal): C(y^2) + d(x) + E(y) + F
'E') = 0 \n";
{cout<< " Thank You!"; cout<< " [5.] Ellipse: A(x^2) +
break;} C(y^2) + D(x) + E(y) + F = 0 \n";
cout<< " [6.] Hyperbola: A(x^2) -
else C(y^2) + D(x) + E(y) + F = 0 \n";
cout << " Wrong input "; cout<< "\n";
break; cout<< " Input Equation: ";
} cin>>p;

case 'b': switch (p)


{
case '1':
cout<< " You have chosen to cout<< "\n";
input Equation, Continue? cout<< " Input the Coefficient
[Y]Yes/[N]No/[E]End: "; of Equation \n\n";
cin>> code; cout<< " A(x^2) +/- B(x) +/- C
{ = 0 \n\n";
if (code == 'y' || code == 'Y') a1: cout<< " Input the value of A:
{goto cont2;} ";
cin>> a;
else if (code == 'n' || code == {
'N') if (cin.fail())
{system("CLS"); {cin.clear();
goto jump;} cin.ignore();
cout<< " \n **Wrong input!
Input number only.** \n\n";
goto a1;} cout<< " Start again? Y/N: ";
cin>> yesno;
else
{ {
cin.ignore(); if (yesno == 'Y' || yesno
} == 'y')
} {system("CLS");
cout<< "\n"; goto jump;}
b1: cout<< " Input the value of B:
"; else
cin>> b; cout<< " Thank you!";
{ break;
if (cin.fail()) }
{cin.clear();
cin.ignore(); case '2':
cout<< " \n **Wrong input! cout<< "\n";
Input number only.** \n\n"; cout<< " Input the Coefficient
goto b1;} of Equation \n\n";
cout<< " A(x^2) + A(y^2) +
else Dx + Ey + F = 0 \n\n";
{ a2: cout<< " Input the value of A:
cin.ignore(); ";
} cin>> a;
} {
cout<< "\n"; if (cin.fail())
c1: cout<< " Input the value of C: {cin.clear();
"; cin.ignore();
cin>> c; cout<< " \n **Wrong input!
{ Input number only.** \n\n";
if (cin.fail()) goto a2;}
{cin.clear();
cin.ignore(); else
cout<< " \n **Wrong input! {
Input number only.** \n\n"; cin.ignore();
goto c1;} }
}
else cout<< "\n";
{ d2: cout<< " Input the value of D:
cin.ignore(); ";
} cin>> d;
} {
cout<< "\n"; if (cin.fail())
cout<< " y = mx + b \n"; {cin.clear();
cout<< " m = b/a \n"; cin.ignore();
cout<< " m = "<< -b<< cout<< " \n **Wrong input!
"/"<<a ; Input number only.** \n\n";
cout<< "\n\n"; goto d2;}
else cout<< " r= "<< sqrt((pow(d,2)
{ + pow(e,2) -4*a*f)/4*(pow(a,2)));
cin.ignore(); cout<<"\n\n";
} cout<< " Start again? Y/N: ";
} cin>> yesno;
cout<< "\n";
e2: cout<< " Input the value of E: {
"; if (yesno == 'Y' || yesno
cin>> e; == 'y')
{ {system("CLS");
if (cin.fail()) goto jump;}
{cin.clear();
cin.ignore(); else
cout<< " \n **Wrong input! cout<< " Thank you!";
Input number only.** \n\n"; break;
goto e2;} }

else case '3':


{ cout<< "\n";
cin.ignore(); cout<< " Input the Coefficient
} of Equation \n\n";
} cout<< " A(x^2) + D(x) + E(y)
cout<< "\n"; + F = 0 \n\n";
f2: cout<< " Input the value of F: a3: cout<< " Input the value of A:
"; ";
cin>> f; cin>> a;
{ {
if (cin.fail()) if (cin.fail())
{cin.clear(); {cin.clear();
cin.ignore(); cin.ignore();
cout<< " \n **Wrong input! cout<< " \n **Wrong input!
Input number only.** \n\n"; Input number only.** \n\n";
goto f2;} goto a3;}

else else
{ {
cin.ignore(); cin.ignore();
} }
} }
cout<< "\n"; cout<< "\n";
cout<< " h= -D/(2A) ; k= - d3: cout<< " Input the value of D:
E/(2A) ; r=sqrt((D^2 + E^2 - ";
4AF)/4(A^2)\n\n"; cin>> d;
cout<< " h= "<<- {
d/(2*a)<<endl; if (cin.fail())
cout<< " k= "<<- {cin.clear();
e/(2*a)<<endl; cin.ignore();
cout<< " \n **Wrong input! cout<< " k= "<<(pow(d,2)-
Input number only.** \n\n"; 4*a*f)/4*a*f<<endl;
goto d3;} cout<< " a= "<<-e/4*a<<endl;
cout<<"\n\n";
else cout<< " Start again? Y/N: ";
{ cin>> yesno;
cin.ignore();
} {
} if (yesno == 'Y' || yesno
cout<< "\n"; == 'y')
e3: cout<< " Input the value of E: {system("CLS");
"; goto jump;}
cin>> e;
{ else
if (cin.fail()) cout<< " Thank you!";
{cin.clear(); break;
cin.ignore(); }
cout<< " \n **Wrong input!
Input number only.** \n\n";
goto e3;} case '4':
cout<< "\n";
else cout<< " Input the Coefficient
{ of Equation \n\n";
cin.ignore(); cout<< " C(y^2) + d(x) + E(y)
} + F = 0 \n\n";
} c4: cout<< " Input the value of C:
cout<< "\n"; ";
f3: cout<< " Input the value of F: cin>> c;
"; {
cin>> f; if (cin.fail())
{ {cin.clear();
if (cin.fail()) cin.ignore();
{cin.clear(); cout<< " \n **Wrong input!
cin.ignore(); Input number only.** \n\n";
cout<< " \n **Wrong input! goto c4;}
Input number only.** \n\n";
goto f3;} else
{
else cin.ignore();
{ }
cin.ignore(); }
} cout<< "\n";
} d4: cout<< " Input the value of D:
cout<< "\n"; ";
cout<< " h= -D/2A ; k= (d^2 cin>> d;
- 4AF)/4AF ; a= -E/4A\n\n"; {
cout<< " h= "<<-d/2*a<<endl; if (cin.fail())
{cin.clear();
cin.ignore(); cout<< " h= "<<(pow(e,2) -
cout<< " \n **Wrong input! 4*a*f)/4*c*d<<endl;
Input number only.** \n\n"; cout<< " k= "<<-e/2*c<<endl;
goto d4;} cout<< " a= "<<-d/4*c<<endl;
cout<<"\n\n";
else cout<< " Start again? Y/N: ";
{ cin>> yesno;
cin.ignore();
} {
} if (yesno == 'Y' || yesno
cout<< "\n"; == 'y')
e4: cout<< " Input the value of E: {system("CLS");
"; goto jump;}
cin>> e;
{ else
if (cin.fail()) cout<< " Thank you!";
{cin.clear(); break;
cin.ignore(); }
cout<< " \n **Wrong input!
Input number only.** \n\n";
goto e4;} case '5':
cout<< "\n";
else cout<< " Input the Coefficient
{ of Equation \n\n";
cin.ignore(); cout<< " A(x^2) + C(y^2) +
} D(x) + E(y) + F = 0 \n\n";
} a5: cout<< " Input the value of A:
cout<< "\n"; ";
f4: cout<< " Input the value of F: cin>> a;
"; {
cin>> f; if (cin.fail())
{ {cin.clear();
if (cin.fail()) cin.ignore();
{cin.clear(); cout<< " \n **Wrong input!
cin.ignore(); Input number only.** \n\n";
cout<< " \n **Wrong input! goto a5;}
Input number only.** \n\n";
goto f4;} else
{
else cin.ignore();
{ }
cin.ignore(); }
} cout<< "\n";
} c5: cout<< " Input the value of C:
cout<< "\n"; ";
cout<< " h= (E^2 - 4AF)/4CD cin>> c;
; k= -E/2C ; a= -D/4C \n\n"; {
if (cin.fail())
{cin.clear(); cin>> f;
cin.ignore(); {
cout<< " \n **Wrong input! if (cin.fail())
Input number only.** \n\n"; {cin.clear();
goto c5;} cin.ignore();
cout<< " \n **Wrong input!
else Input number only.** \n\n";
{ goto f5;}
cin.ignore();
} else
} {
cout<< "\n"; cin.ignore();
d5: cout<< " Input the value of D: }
"; }
cin>> d; cout<< "\n";
{ cout<< " h= (-D)/2A ; k= (-
if (cin.fail()) E)/2C \n\n";
{cin.clear(); cout<< " h= "<<(-
cin.ignore(); d)/2*a<<endl;
cout<< " \n **Wrong input! cout<< " k= "<<(-
Input number only.** \n\n"; e)/2*c<<endl;
goto d5;} cout<<"\n\n";
cout<< " Start again? Y/N: ";
else cin>> yesno;
{
cin.ignore(); {
} if (yesno == 'Y' || yesno
} == 'y')
cout<< "\n"; {system("CLS");
e5: cout<< " Input the value of E: goto jump;}
";
cin>> e; else
{ cout<< " Thank you!";
if (cin.fail()) break;
{cin.clear(); }
cin.ignore();
cout<< " \n **Wrong input!
Input number only.** \n\n"; case '6':
goto e5;} cout<< "\n";
cout<< " Input the Coefficient
else of Equation \n\n";
{ cout<< " A(x^2) - C(y^2) +
cin.ignore(); D(x) + E(y) + F = 0 \n\n";
} a6: cout<< " Input the value of A:
} ";
cout<< "\n"; cin>> a;
f5: cout<< " Input the value of F: {
"; if (cin.fail())
{cin.clear(); cin>> e;
cin.ignore(); {
cout<< " \n **Wrong input! if (cin.fail())
Input number only.** \n\n"; {cin.clear();
goto a6;} cin.ignore();
cout<< " \n **Wrong input!
else Input number only.** \n\n";
{ goto e6;}
cin.ignore();
} else
} {
cout<< "\n"; cin.ignore();
c6: cout<< " Input the value of C: }
"; }
cin>> c; cout<< "\n";
{ f6: cout<< " Input the value of F:
if (cin.fail()) ";
{cin.clear(); cin>> f;
cin.ignore(); {
cout<< " \n **Wrong input! if (cin.fail())
Input number only.** \n\n"; {cin.clear();
goto c6;} cin.ignore();
cout<< " \n **Wrong input!
else Input number only.** \n\n";
{ goto f6;}
cin.ignore();
} else
} {
cout<< "\n"; cin.ignore();
d6: cout<< " Input the value of D: }
"; }
cin>> d; cout<< "\n";
{ cout<< " h= -(D/2A) ; k= -
if (cin.fail()) (E/2C) \n\n";
{cin.clear(); cout<< " h= "<<-
cin.ignore(); (d/2*a)<<endl;
cout<< " \n **Wrong input! cout<< " k= "<<-
Input number only.** \n\n"; (e/2*c)<<endl;
goto d6;} cout<<"\n\n";
cout<< " Start again? Y/N: ";
else cin>> yesno;
{
cin.ignore(); {
} if (yesno == 'Y' || yesno
} == 'y')
cout<< "\n"; {system("CLS");
e6: cout<< " Input the value of E: goto jump;}
";
else
cout<< " Thank you!";
break;
}
}
}

return 0;
}

You might also like