📄 hello.cpp
字号:
#include <iostream.h>
#include "quad.h"
void PrintResults(quadratic &gook);
void Intersection(quadratic &mutha, quadratic &phuqa);
int main( void )
{
A: char choice;
double a, b, c, d, e, f;
// double domain;
cout << "*** QUADRATIC EQUATION CALCULATOR ***" << endl;
cout << " ax^2 + bx + c" << endl;
cout << "Please enter the \'a\' variable now: ";
cin >> a;
cout << "Please enter the \'b\' variable now: ";
cin >> b;
cout << "Please enter the \'c\' variable now: ";
cin >> c;
quadratic shihdog(a, b, c);
cout << " " << shihdog.get_a() << "x^2 + " << shihdog.get_b() << "x + " << shihdog.get_c() << endl;
PrintResults(shihdog);
// Break for Calculation of Range
// cout << endl << "Please enter a Domain variable (any x integer): ";
// cin >> domain;
cout << endl << "--You will now enter in a second equation in same format--" << endl;
cout << "Please enter another \'a\' variable now: ";
cin >> d;
cout << "Please enter another \'b\' variable now: ";
cin >> e;
cout << "Please enter another \'c\' variable now: ";
cin >> f;
quadratic shihdawg(d, e, f);
cout << " " << shihdawg.get_a() << "x^2 + " << shihdawg.get_b() << "x + " << shihdawg.get_c() << endl;
PrintResults(shihdawg);
Intersection(shihdog, shihdawg);
cout << "Would you like to enter new data (y/n)? ";
Z: cin >> choice;
switch (choice)
{
case 'y':
goto A;
break;
case 'n':
cout << "***GOODBYE***";
getchar();
break;
default:
goto Z;
break;
}
}
void PrintResults(quadratic &gook)
{
// Break For Xint
cout << endl << "X-Intercepts: ";
if (gook.numxintercept() == 0)
cout << "NONE" << endl;
else if (gook.numxintercept() == 1)
cout << "x=" << gook.xint1() << endl;
else
cout << "x=" << gook.xint1() << ", x=" << gook.xint2() << endl;
// Break For Vertex
cout << " Vertex: (" << gook.xvertex() << "," << gook.yvertex() << ")" << endl;
// Break for Min or Max BS
cout << " f(x) status: " << gook.min_or_max() << endl;
}
void Intersection(quadratic &mutha, quadratic &phuqa)
{
cout << endl;
if (!mutha.hasintercepts(phuqa))
cout << "NO POINTS OF INTERSECTION" << endl;
else
cout << "Intersection Points: (" << mutha.xintercept1(phuqa) << "," << mutha.yintercept1(phuqa) << ") (" << mutha.xintercept2(phuqa) << "," << mutha.yintercept2(phuqa) << ")" << endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -