aboutsummaryrefslogtreecommitdiffstats
path: root/src/projet.cpp
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2016-04-17 15:28:26 -0400
committerGuillaume Horel <guillaume.horel@gmail.com>2016-04-17 15:28:26 -0400
commita1f3913bc49cdeacd6db9b25b104c238642e16ce (patch)
tree44f8910575d089cfd6cc64dd7f442f40d5298ba6 /src/projet.cpp
parent035b9a38db12b56ae59df64738fd0a974ec63239 (diff)
downloadprojet_C++-a1f3913bc49cdeacd6db9b25b104c238642e16ce.tar.gz
rend la table un peu plus belle
Diffstat (limited to 'src/projet.cpp')
-rw-r--r--src/projet.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/projet.cpp b/src/projet.cpp
index a89c793..6bcd90a 100644
--- a/src/projet.cpp
+++ b/src/projet.cpp
@@ -112,12 +112,13 @@ void exemple2_rqmc() {
int make_table(vector< vector<double> > data1, vector< vector<double> > data2) {
std::fstream fs("doc/table.tex", std::fstream::out);;
- fs<<R"(\begin{tabular}{|l|ll|ll|l|})"<<std::endl;
+ fs<<R"(\begin{tabular}{|r|rr|rr|r|})"<<std::endl;
fs<<R"(\hline)"<<endl;
- fs<<"N"<<" & "<<R"($\mu_{strat}$)"<<" & "<<R"($\mu_{rqmc}$)"<<" & "<<R"($IC_{strat}$)"<<" & "<<R"($IC_{rqmc}$)"<<" & "<<"Ratio strat/rqmc"<<R"(\\ \hline)"<<std::endl;
+ fs<<"N"<<" & "<<R"($\mu_{strat}$)"<<" & "<<R"($\mu_{rqmc}$)"<<" & "<<R"($\textrm{IC}_{strat}$)"<<" & "<<R"($\textrm{IC}_{rqmc}$)"<<" & "<< R"($\textrm{IC}_{strat}/\textrm{IC}_{rqmc}$)"<<R"(\\ \hline)"<<std::endl;
+ fs.precision(2);
for (int i=0; i< 4; i++) {
double ic_strat = 1.95996*sqrt(data1[i][2]/(double) data1[i][0]);
- fs<<data1[i][0]<<"&"<<data1[i][1]<<"&"<<data2[i][0]<<"&"<<ic_strat<<"&"<<data2[i][2]/2<<"&"<<ic_strat/(data2[i][2]/2)<<R"(\\ \hline)"<<std::endl;
+ fs<<(int)data1[i][0]<<"&"<<scientific<<data1[i][1]<<"&"<<data2[i][0]<<"&"<<ic_strat<<"&"<<data2[i][2]/2<<"&"<<fixed<<ic_strat/(data2[i][2]/2)<<R"(\\ \hline)"<<std::endl;
}
fs<<R"(\end{tabular})"<<std::endl;
fs.close();