Struct output problem

Can someone tell me how to change the code so the input to be like that:

1
2
||nick                   || ||9             || ||man  || ||6    || ||5     || ||4          || ||3        || ||2        || ||4                ||
||john                   || ||10            || ||man  || ||6    || ||2     || ||4          || ||3        || ||5        || ||4                || 


because with the code below the output look like this

1
2
3
||nick                 || ||9              || ||man  || ||6    || ||5     || ||4          || ||3        || ||2        || ||4                ||
||
john                || ||23             || ||man  || ||6    || ||2     || ||4          || ||3        || ||5        || ||4                ||


CODE
1
2
3
4
5
6
7
8
9
10
11
12
    for(int j=0;j<i;j++)
    {
        cout<<"||"<<a[j].name<<setw(23-a[j].name.size())<<"||"<<" "<<"||";
        cout<<a[j].dateofbirth<<setw(17-a[j].dateofbirth.size())<<"||"<<" "<<"||";
        cout<<a[j].sex<<setw(7-a[j].sex.size())<<"||"<<" "<<"||";
        cout<<a[j].marks[0]<<setw(6)<<"||"<<" "<<"||";
        cout<<a[j].marks[1]<<setw(7)<<"||"<<" "<<"||";
        cout<<a[j].marks[2]<<setw(12)<<"||"<<" "<<"||";
        cout<<a[j].marks[3]<<setw(10)<<"||"<<" "<<"||";
        cout<<a[j].marks[4]<<setw(10)<<"||"<<" "<<"||";
        cout<<a[j].averagesuccess<<setw(18)<<"||"<<"*"<<endl;
    }


And can you suggest me the most simple way to print the data in table view(without ||)
Last edited on
Please, do not double-post. Previous thread: http://www.cplusplus.com/forum/beginner/224923/
Yes I know but I think that the people won't understand what I mean with my previous post also I tried the last thing you told me but it doesn't work
Topic archived. No new replies allowed.