Can someone tell me how to change the code so the input to be like that:
1 2 3
|
||nick || ||9 || ||man || ||6 || ||5 || ||4 || ||3 || ||2 || ||4 ||
||john || ||10 || ||man || ||6 || ||2 || ||4 || ||3 || ||5 || ||4 ||
||mary || ||23 || ||woman|| ||5 || ||6 || ||4 || ||4 || ||2 || ||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;
}
|
Last edited on
No, I mean that with the code in my previous post my the output is like this
1 2 3
|
||nick || ||9 || ||man || ||6 || ||5 || ||4 || ||2 || ||3 || ||4 ||
||
john || ||23 || ||man || ||5 || ||6 || ||4 || ||3 || ||2 || ||4 ||
|
but I want to be like this
1 2
|
||nick || ||9 || ||man || ||6 || ||5 || ||4 || ||3 || ||2 || ||4 ||
||john || ||10 || ||man || ||6 || ||2 || ||4 || ||3 || ||5 || ||4 ||
|
(the data shouldn't be the same)
Last edited on
Yes but how to make it with for loop in my case
Last edited on