I was having trouble organizing the output into a console for a project. So I wrote a function to add spaces onto strings to format it correctly. Now I am having trouble with 0's not being the proper length before the decimal and it is breaking the format. How can I change a 0.00 into a 00.00? Here is my current function:
void organize(string n[], double tstData[][COLUMN])
{
int j = 0;
string spaces[12] = {" "," "," "," "," "," "," "," "," "," "," "," "};
string holder = "";
for (int i = 0; i < 40; i++) {
if (n[i].size() < 17) {
j = 17 - n[i].size();
j = j - 1;
holder = n[i];
holder = holder + spaces[j];
n[i] = holder;
}
for (j = 0; j < 4; j++) {
if (tstData[i][j] == 0.00) {
tstData[i][j] = 00;
}
}
}
}