I have trouble getting my values to line up correctly

Hello, I am having trouble getting my values to line up correctly with the appropriate columns. Some help would be appreciated...

here is the code below:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name[10];
int id[10];
int sub1[10];
int sub2[10];
int sub3[10];
int sub4[10];
int i;

for(i=0;i<=9;i++)
{
cout<<"Please enter student's name: ";
cin>>name[i];
cout<<"Please enter student's ID number: ";
cin>>id[i];
cout<<"Please enter marks for sub 1: ";
cin>>sub1[i];
cout<<"Please enter marks for sub 2: ";
cin>>sub2[i];
cout<<"Please enter marks for sub 3: ";
cin>>sub3[i];
cout<<"Please enter marks for sub 4: ";
cin>>sub4[i];
}
cout << endl;
cout << "Name" << " " << "IDNo" << " " << "Sub1" << " " << "Sub2" << " " << "Sub3" << " " << "Sub4" << endl;
for(i=0;i<=9;i++)
{
cout << name[i] << " " << id[i] << " " << sub1[i] << " " << sub2[i] << " " << sub3[i] << " " << sub4[i] << endl;
}
return 0;
}
Alternately you can use setw() function to properly format the output, ex setw(4).
#include <iomanip> must be present in the header list.
Alternately you can use setw()

that was what the link was in my post...
I'm not too familiar on how use the sets() function yet...would u guys be kind enough to show me where to put it in the code I posted?
read that link. examples are there.
Topic archived. No new replies allowed.