My class did a practice program and worked thru it however i was absent due to illness but i was sent the parameters they used for practice. I attempted it on my own but i was unable to figure it completely but i did get part of it down before completely messing up. These are the parameters for the program.

Define a struct that captures the following information about a student:
• First name
• Last name
• 9-digit ID number
• 5 numeric lab grades
• 5 numeric program grades
• 3 numeric exam grades
• Final numeric grade
You will define an array of 10 students.
Create a function that will populate the array of structures through interactive keyboard input.
Create a separate function that will calculate the final grade for all students, according to the following
formula:
• Labs are worth 25% of the final grade
• Programs are worth 30% of the final grade
• Exams are worth 45% of the final grade
After all calculations for all students are complete, your program should then output each student’s name and
their respective letter grade as follows:
• Students with a final grade of 90 and above earn an A
• Students with a final grade of 80 to 89 earn a B
• Students with a final grade of 70 to 79 earn a C
• Students with a final grade of 60 to 69 earn a D
• Students with a final grade below 60 earn an F
Be sure to include user-input validation.

This is what i have so far.

#include <iostream>
#include <string>
using namespace std;

struct Student
{
	string firstname;
	string lastname;
	int idNo;
	int labGrades[5];
	int programGrade[5];
	int examGrades[3];
	double finalGrade;
};

double calculateFinal(Student);

int main()

students[10];

If someone could help me with this i would greatly appreciate it.

Recommended Answers

All 5 Replies

Sure, someone will be glad to help, but please make some attempt at those two functions. No one is going to write it for you. I know you said you "messed up," but that's what we need to see to get you going in the right direction.

Start with the input function, that shouldn't be anything you haven't seen before, step through the array with a loop and prompt the user to input all of the fields.

My god being sick makes everything impossible. Apologies for leaving this thread hanging but my migraines have put me behind. Im still dealing with my migraines but i am on so much medication for pain that i am feeling off.

I am trying to do some work while i can right this second.
This is what i have right now. I know im still missing the function to calculate the final grade but as well as other things but im lost as where to go from here.

#include <iostream>
#include <string>
using namespace std;

struct Student
{
	string firstname;
	string lastname;
	int idNo;
	int labGrades[5];
	int programGrade[5];
	int examGrades[3];
	double finalGrade;
};

double calculateFinal(Student);

Studentinfo(Student);

int main()
{
Student[10];

return 0
}

{
	StudentInfo();
	for (i = 0; i < 10; i++)
	{
		cout << "Students first name : ";
		cin >> string Student[i].firstname;
		cout << "Students last name : ";
		cin >> string Student[i].lastname;
		cout << "Student 9 digit ID number : ";
		cin >> int Student[i].idNo;
		cout << "Students 5 numeric lab grades : ";
		cin >> int Student[5][i].labGrades;
		cout << "Students 5 numeric program grades : ";
		cin >> int Student[5][i].programGrades;
		cout << "Students 3 numeric exam grades : ";
		cin >> int Student[3][i].examGrades;
	}

return 

}

Hopefully the meds dont put me to sleep before i finish =)

It is close to impossible to answer a question that is not asked. And you didn't ask one. So, we don't know what to help with...

You don't need the type of the variable when getting the input (on lines 32, 34, etc). Also, look up what your function definition is supposed to look like, lines 26-28 make no sense.

There are a few other issues, but, as WaltP has stated, there's no question here. I know it's a pain to catch up on your work, but do the best you can with the resources that you have (notes, textbook) and post back with something like, "well, my function does this when I put inputs X, Y, and Z into it, but I'd expect it to do something else."

... post back with something like, "well, my function does this when I put inputs X, Y, and Z into it, but I'd expect it to do something else."

Almost. Post back with
"well, my function does this when I put inputs X, Y, and Z into it, but I'd expect it to do this instead."

We don't want you to just say "I expected it to do something different" like so many people do. Explain everything in detail.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.