Declare a structure that contains: student Id, first name, last name, and five test scores. Also declare an array of 10 student structures. Prompt the user and read the student data from the keyboard and store the information in the array. After each student ask the user if there is to be another entry. When there are no more entries, clear the screen (system(“cls”)); then loop through the array to print each student. Calculate the average score for each student and test. Write the information in tabular form to the screen, one line for each student (including the average score) and a total line for the average score for each test. Don’t forget appropriate headings.

PLEASE SOMEONE HELP ME ON THIS PROBLEM. THANK YOU

Edited by darshilpatel34: n/a

4
Contributors
7
Replies
8
Views
6 Years
Discussion Span
Last Post by WaltP

You need to show efforts of your own before you can hope to get help on specific problems you encounter while doing this assignment. We don't just do your homework for you, because that would not help you or anyone else.

You need to show efforts of your own before you can hope to get help on specific problems you encounter while doing this assignment. We don't just do your homework for you, because that would not help you or anyone else.

Sir I did try this problem to solve but I'm stuck at how do I create loop that will count the average of grades across and from up to down.For example:
Id Student Name 1 2 3 4 5 Avg
1 Arnold, Edward 87 86 90 89 95 89.4
2 Bara, Theda 79 80 76 87 80 80.4
3 Davis, Bette 90 92 100 93 95 94.0
4 Hayes, Patrick 88 70 75 80 73 77.2
5 Day, Loraine 82 71 100 98 99 90.0
6 Ball, Lucille 98 85 72 89 91 87.0
7 Bond, James 95 100 100 90 100 97.0
Average: 88 83 88 89 90 87.9

Put the numbers in a 2d array (if you haven't done this yet) then add each element according to their index using a loop and lastly divide it by the total number of items

same method can be applied in getting the average of grades across or from up to down with little changes in the indexes while looping

Edited by zeroliken: n/a

You didn't take Mike's hint. Here's mine:

[boilerplate_help_info]

``````Posting requests for help must be well thought out if you want help quickly and correctly.  Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful?  Check your post with these checkpoints - what is it [i]you[/i] missed:
[list=1]
- What's wrong with my code?
- Why doesn't this work?
- Anything else that does not give us useful information.
[*]Post your code.  If we don't know what you did, how can we possibly help?
- Use [b]PROPER FORMATTING[/b] -- see this
- Use CODE Tags so your formatting is preserved.
If we can't follow your code, it's difficult to help. We don't care that you're still working on it. If you want us to read it, it must be readable
[*]Explain what the code is supposed to do.  If we don't know where the target is, how can we help you hit it?
[*]Explain what actually happened! If we don't know where the arrow went when you shot it, how can we tell what went wrong and how far from the target you are?
[*]If you have errors, post them! We can't see your screen.  We can't read your mind. You need to tell us what happened.
If anyone posts working code for you, they are a cheater.
If you use that code [i]you[/i] are a cheater.
[*]Do [b]not[/b] bore us with how new you are. We can tell by your code.
- Do not apologize. We were all new, and unless you are completely
brain dead you will get better.
- Do not ask us to "take it easy on you."
- Do not say "I don't know what's going on." That's obvious since
you posted for help. Use that time wisely by [b]explaining[/b] as best
you can so we can help.
[*]Do not apologize for posting 'late'. We don't have any expectations on when you should be posting - 10 minutes or 10 days. We aren't timing your responses.
[*][b]Do not post your requirements and nothing else. [/b]We view that as a lazy do-nothing student that wants us to do their work for them. That's cheating and we [i]will[/i] be hard on you.
[*]Do not attach files except when absolutely necessary. Most of us are not going to download files.  Add the information to your post.
[*][b]Do not tell us how urgent it is.[/b] Seriously, for us there is no urgency at all. Many that can help will ignore any URGENT or ASAP requests.
[*]Create a [b][i]good[/i][/b] title for your post. The title [b]C++[/b] in the C++ forum is bloody redundant and worthless!  [b]What's wrong?[/b] equally so. What are you having trouble with? [i]There[/i] is your title. [i](note: [b]my program[/b] is not the answer.)[/i]
[/list]
Think more about your next post so we don't have to play 20 questions to get the info we need to help you.``````

[/boilerplate_help_info]

Note #2,4,6,9,12

You need to show efforts of your own before you can hope to get help on specific problems you encounter while doing this assignment. We don't just do your homework for you, because that would not help you or anyone else.

`Mike this is what i have so far if you can please help me figure out. Thank You.`

``````//  Student List

#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

const int SIZE = 2;

struct Student
{
int stuID;
string firstName;
string lastName;
int scores[5];

};

bool getStudent(Student& stu);
void printStudent(const Student sList[], int size);

int main()
{
cout << "\n\tBegin Student struct Demo\n\n";

int index = 0;

Student stu;
Student sList[SIZE];

bool done = false;
while(!done)
{
done = getStudent(stu);
if(!done)
{
index++;
}
//student listsize = index;

// cout << "Student Listing\n\n";
printStudent(sList, SIZE);
//    cout << "\n\nEnd Student List\n\n";

system("pause");
return 0;
}

}
bool getStudent(Student& stu)

{

cout << "Enter the first name of student " ;

getline(cin, stu.firstName);

cout << "Enter the last name of student " ;
getline(cin, stu.lastName);

cout << "Enter student test score: ";
for (int i = 0; i < 5; i++)
{
cin >> stu.scores[i];
}
system("cls");
}

void printStudent(const Student sList[], int size)
{
//cout << fixed << noshowpoint << setprecision(0);
cout << left << setw(25)<< "Student Name"
<< setw(11) << "Test Score"<< endl;

for (int i = 0; i < size; i++)
cout << left //<< setw(25)
<< sList[i].firstName
<< sList[i].lastName << right << " "
<< setw(25) << sList[i].scores << endl;

return;
}``````

Declare a structure that contains: student Id, first name, last name, and five test scores. Also declare an array of 10 student structures. Prompt the user and read the student data from the keyboard and store the information in the array. After each student ask the user if there is to be another entry. When there are no more entries, clear the screen (system(“cls”)); then loop through the array to print each student. Calculate the average score for each student and test. Write the information in tabular form to the screen, one line for each student (including the average score) and a total line for the average score for each test. Don’t forget appropriate headings.

PLEASE SOMEONE HELP ME ON THIS PROBLEM. THANK YOU

This is what I have so far if someone please help me it would be greatly appreciated. I'm sorry I'm a newbie.

``````//  Student List

#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

const int SIZE = 2;

struct Student
{
int stuID;
string firstName;
string lastName;
int scores[5];

};

bool getStudent(Student& stu);
void printStudent(const Student sList[], int size);

int main()
{
cout << "\n\tBegin Student struct Demo\n\n";

int index = 0;

Student stu;
Student sList[SIZE];

bool done = false;
while(!done)
{
done = getStudent(stu);
if(!done)
{
index++;
}
//student listsize = index;

// cout << "Student Listing\n\n";
printStudent(sList, SIZE);
//    cout << "\n\nEnd Student List\n\n";

system("pause");
return 0;
}

}
bool getStudent(Student& stu)

{

cout << "Enter the first name of student " ;

getline(cin, stu.firstName);

cout << "Enter the last name of student " ;
getline(cin, stu.lastName);

cout << "Enter student test score: ";
for (int i = 0; i < 5; i++)
{
cin >> stu.scores[i];
}
system("cls");
}

void printStudent(const Student sList[], int size)
{
//cout << fixed << noshowpoint << setprecision(0);
cout << left << setw(25)<< "Student Name"
<< setw(11) << "Test Score"<< endl;

for (int i = 0; i < size; i++)
cout << left //<< setw(25)
<< sList[i].firstName
<< sList[i].lastName << right << " "
<< setw(25) << sList[i].scores << endl;

return;
}
``````

Edited by mike_2000_17: Fixed formatting

Now you missed #1, #4, #5, and #7.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.