Can any1 help me with printing out the student record when the user inputs the information? i wrote a for loop statement to print out the user input and set the width to 60, but it doesn't print it out...
#include<iostream>
#include<iomanip>
using namespace std;
struct Record
{
char lastName[80];
char firstName[80];
char id[20];
int score;
};
int main ()
{
Record student[5];
char dummy;
for(int i=0; i<5; i++){
cout<<"Enter last name: ";
cin>>student[i].lastName;
dummy=getchar();
cout<<"Enter first name: ";
cin.getline(student[i].firstName, 80);
cout<<"Enter id: ";
cin>>student[i].id;
cout<<"Enter score: ";
cin>>student[i].score;
}
for(int i=0; i<5; i++){
cout<<setw(60)<<student[i].lastName
<<setw(60)<<student[i].firstName
<<setw(60)<<student[i].id
<<setw(60)<<student[i].score<<endl;
}
}