I have the following program below I have the output but i dont know how to get it. The out put gives the names Jane Doe and Joe Public along with their GPA's per semester. I just need help explaining (detailed) what happens in each line. Especially what the period is between words. Your help is much appreciated
struct StudRec
{
string name;
float semgpas[14];
int enrolled;
:
StudRec jane,joe;
int i;
jane.name = "Jane Doe";
for (i=0; i < 12; i++)
jane.semgpa[i] = 4.00 - i/100.0;
jane.enrolled = 2004;
joe.enrolled = jane.enrolled + 2;
joe.name = "Joe Public";
for (i=6; i>=0; i--)
joe.semgpas[6-i] = jane.semgpas[i];
cout<<fixed<<setprecision(2);
cout<<"Student Name: "<<joe.name<<endl;
cout<<"Semester-by-semester gpas"<<endl;
for (i=0; i < 7; i++)
cout<<joe.semgpas[i]<<" ";
cout<<"Year enrolled: "<<joe.enrolled<<endl<<endl;
cout<<"Student Name: "<<jane.name<<endl;
cout<<"Semester-by-semester gpas"<<endl;
for (i=0; i < 12; i++)
cout<<jane.semgpas[i]<<" ";
cout<<"Year enrolled: "<<jane.enrolled<<endl<<endl;
I guess the question was misunderstood. I was given this program. I did not write it. I need it to be broken down to me step by step what is going on because as of now I am lost. I cant modify the program I just need to interpret the output. I have it already but I want to know how we get the the output because I am confused
I fear, nobody understands this code, especially the colon after "int enrolled;" and the code after the colon. You should look, wether your example is really the same, what you posted here.