Here is my code:
#include <iostream>
using namespace std;
#include <iostream> #include <math.h> #include <stdio.h> #include <iomanip> #include <stdlib.h> #include "statistics.cpp" #include "specialfunctions.cpp" #include "linalg.cpp" #include "alglibinternal.cpp" #include "alglibmisc.cpp" #include "ap.cpp" #include "dataanalysis.cpp" #include "diffequations.cpp" #include "fasttransforms.cpp" #include "integration.cpp" #include "interpolation.cpp" #include "optimization.cpp" #include "solvers.cpp" #include <stdafx.h> #include <cmath>
using namespace std; using namespace alglib; using namespace alglib_impl;
int main() { cout << "Effectif 1:" << endl;
float Effectif1(0);
cin >> Effectif1;
cout << "Effectif 2:" << endl;
float Effectif2(0);
cin >> Effectif2;
cout << "Pourcentage 1:" << endl;
float Pourcentage1(0);
cin >> Pourcentage1;
cout << "Pourcentage 2:" << endl;
float Pourcentage2(0);
cin >> Pourcentage2;
float a(0), b(0), c(0), d(0), Student(0) ;
a = Effectif1; b = Effectif2; c = Pourcentage1/100; d = Pourcentage2/100; Student = (c - d)/sqrt((c*(1-c))/a +((d*(1-d))/b));
cout << "Student:" <<Student << endl;
float Probabilite(0), e(0), ddl(0);
e = a + b; ddl = e - 2;
//Probabilite = alglib_impl::studenttdistribution(Student,ddl,NULL);
Probabilite = alglib::studenttdistribution(Student, ddl);
cout << "Probabilite: " << Probabilite << endl;
if(fabs(Student)>2.580) { cout << "Significativite : +++ " << endl; } ;
if(fabs(Student)>1.960 && (fabs(Student)<2.580)) { cout << "Significativite : ++ " << endl; } ;
if((fabs(Student)>1.645) && (fabs(Student)<1.960)) { cout << "Significativite : + " << endl; } ; if(fabs(Student)<1.645) { cout << "Significativite : Not significant " << endl; } ;
return 0;
}
________________________________________________________________________________________________________________ When i execute i have:
Effectif 1: 100 Effectif 2: 100 Pourcentage 1: 45 Pourcentage 2: 51 Student:-0.850743 terminate called after throwing an instance of 'alglib::ap_error
It doesn't calculate the probability
|