QCustomPlot Discussion and Comments

DerdegraadsFunctie grafische weergaveReturn to overview

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
void teken(int waarde);

int discriminant(int a, int b, int c);
void nulpunten(int a, int b, int c, int discr, double &x1, double &x2, double &x0); // & is een argument die in een andere plek wordt verandert

int main(){

int a, b, c, d;
int e;
int deler = 0;
int discr = 0;

double x1 = 0;
double x2 = 0;
double x0 = 0;

cout << "Geef een functie van de vorm ax^3 + bx^2 + cx + d = 0" << endl;

cout << "Wat is a?" << endl;
cin >> a;
cout << "Wat is b?" << endl;
cin >> b;
cout << "Wat is c?" << endl;
cin >> c;
cout << "Wat is d?" << endl;
cin >> d;

cout << "f(x)= " << a << "x^3 ";
teken(-b);
cout << "x^2 ";
teken(-c);
cout << "x ";
teken(-d);
cout << " = 0" << endl;

if(d < 0)
e = -d;
else
e = d;

cout << "De delers van de constante term zijn:";

for(int i = 1; i <= e; i++){
if(e % i == 0){
if(i == 1){
cout << i << ", -" << i;
}else{
cout << ", " << i << ", -" << i;
}
}
}

cout << endl;

for(int x = 1; x <= e; x++){
if(e % x == 0){
if(a*x*x*x + b*x*x + c*x + d == 0){
deler = x;
break;
}
if(a*(-x)*(-x)*(-x) + b*(-x)*(-x) + c*(-x) + d == 0){
deler = -x;
break;
}
}
}

int b1 = b + deler * a;
int c1 = c + deler * b1;
cout << endl;
cout << setw(4) << '|' << setw(6) << a << setw(8) << b << setw(10) << c << setw(11) << d << endl;
cout << setw(3) << deler << setw(1) << '|' << setw(14) << a * deler << setw(10) << (deler * (b + deler * a)) << setw(11) << (deler * (c + deler * (b + deler * a))) << endl;
cout << setfill('_') << setw(42) << " " << endl;
cout << setfill(' ') << setw(4) << '|' << setw(6) << a << setw(8) << (b + deler * a) << setw(10) << (c + deler * (b + deler * a)) << setw(10) << '|' << (d + deler * (c + deler * (b + deler * a))) << endl;
cout << endl;

cout << "Vereenvoudigde vorm:";
cout << "f(x) = (x ";

teken(-deler);
cout << ")(" << a << "x^2 ";
teken(b1);
cout << "x ";
teken(c1);
cout << ")" << endl;

discr = discriminant(a, b1, c1);
cout << "Discriminant = " << discr << endl;

nulpunten(a, b1, c1, discr, x1, x2, x0);
if(discr > 0){
cout << "X1 = " << x1 << endl;
cout << "X2 = " << x2 << endl;
cout << "f(x) = (x ";
teken(-deler);
cout << ")(x ";
teken(-x1);
cout << ")(x ";
teken(-x2);
cout << ") = 0";

}
else if(discr == 0){
cout << "X0 = " << x0 << endl;
cout << "f(x) = (x - " << deler << ")(x - " << x0 << ")^2 = 0" << endl;
}
else{
cout << "Er zijn geen andere nulwaarden" << endl;
}

return 0;
}

int discriminant(int a, int b, int c){
return b*b - 4*a*c;
}

void nulpunten(int a, int b, int c, int discr, double &x1, double &x2, double &x0){
if(discr > 0){
x1 = (-b + sqrt(discr)) / (2*a);
x2 = (-b - sqrt(discr)) / (2*a);
}
else if(discr == 0){
x0 = -b / (2.0*a);
}
}
void teken(int waarde){
if(waarde < 0)
cout << "- " << -waarde;
else
cout << "+ " << waarde;
}

The code was an error, i wanted to ask how i get to the app, i downloaded the latest package but all i get is a folder with multiple text documents, can anyone tell me what the steps are how to get to the app?