Ausgabe der Zeile als Dezimalzahl

This commit is contained in:
Jonny007-MKD 2013-11-21 21:51:23 +01:00
parent 8ed80f3d68
commit 100f4224cf

View file

@ -2,6 +2,7 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <iomanip>
#include "Cell.h" #include "Cell.h"
#include "PrimImplikant.h" #include "PrimImplikant.h"
#include "Wertetabelle.h" #include "Wertetabelle.h"
@ -17,6 +18,8 @@ void Wertetabelle::Print()
for (uint i = 0; i < numElements; i++) for (uint i = 0; i < numElements; i++)
{ {
cout << "| "; // => |
cout << setfill(' ') << setw(ceil(log10((float)numElements))) << i; // => 4
cout << " |"; // => | cout << " |"; // => |
this->printI(i); // => 0 1 0 0 this->printI(i); // => 0 1 0 0
cout << "| "; // => | cout << "| "; // => |
@ -37,7 +40,7 @@ string Wertetabelle::makeHeader()
{ {
bool setPad = padding.size() == 0; bool setPad = padding.size() == 0;
string row2 = "|"; string row2 = "|" + string(ceil(log10((float)numElements)) + 2, ' ') + "|";
for (vector<string>::iterator v = variables->begin(); v < variables->end(); v++) for (vector<string>::iterator v = variables->begin(); v < variables->end(); v++)
{ {
row2 += " " + *v; row2 += " " + *v;