consolidate all repos to one for archive
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#define f(x) a*x*x+b*x+c
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
float a, b, c, i, k=0, x1, x2, diskriminanta, realPart, imaginaryPart;
|
||||
float min, max, der = 0, intg = 0;
|
||||
double h=0.0001;
|
||||
cout<<"Vpisi a: ";
|
||||
cin>>a;
|
||||
cout<<"Vpisi b: ";
|
||||
cin>>b;
|
||||
cout<<"Vpisi c: ";
|
||||
cin>>c;
|
||||
|
||||
cout<<"Začetna vrednost:"<< c <<endl;
|
||||
|
||||
diskriminanta = b*b - 4*a*c;
|
||||
|
||||
if (diskriminanta > 0) {
|
||||
x1 = (-b + sqrt(diskriminanta)) / (2*a);
|
||||
x2 = (-b - sqrt(diskriminanta)) / (2*a);
|
||||
cout << "Ničle so različne" << endl;
|
||||
cout << "x1 = " << x1 << endl;
|
||||
cout << "x2 = " << x2 << endl;
|
||||
}
|
||||
|
||||
else if (diskriminanta == 0) {
|
||||
cout << "Ničle so iste" << endl;
|
||||
x1 = -b/(2*a);
|
||||
cout << "x1 = x2 =" << x1 << endl;
|
||||
}
|
||||
|
||||
else {
|
||||
realPart = -b/(2*a);
|
||||
imaginaryPart =sqrt(-diskriminanta)/(2*a);
|
||||
cout << "Ničle so kompleksne" << endl;
|
||||
cout << "x1 = " << realPart << "+" << imaginaryPart << "i" << endl;
|
||||
cout << "x2 = " << realPart << "-" << imaginaryPart << "i" << endl;
|
||||
}
|
||||
|
||||
|
||||
cout << "Vstavi x: ";
|
||||
cin >> min;
|
||||
der = ((f(min+h)-f(min))/h);
|
||||
cout << "Odvod je: "<< der << endl;
|
||||
|
||||
cout << "Vstavi Xmin: ";
|
||||
cin >> min;
|
||||
cout<< "Vstavi Xmax: ";
|
||||
cin >> max;
|
||||
i=min;
|
||||
while(i<max){
|
||||
intg = (f(i)+f(i+h));
|
||||
intg = intg*h;
|
||||
intg = intg/2;
|
||||
k=intg+k;
|
||||
i=i+h;
|
||||
}
|
||||
cout << "\nIntegrala je " << intg <<endl;
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user