954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Difficult programming challenge

I have a very hard programming challenge and i need help... I have nothing so far, so im hoping somebody could help me build it...

Im to write a program that uses a structure to store student name, student ID number, pointer to and array of test scores, average test score, and course grade.
Program should keep list of tests scores for a group of students, ask the user for how many test scores and how many students there are. It should then dynamically allocate (pointer?) and array of structures. Each structure's test menber should point to a dynamically allocated array (pointer?) which will hold the tests scores.

After this, program should ask for ID number and test scores for each student. Average test score should be calculates and stored in the average member of each structure. score grade should be computed (91-100=A and so on).

Score grade should then be stored in the Grade member of each structure...once data is calbulated, a table should show student's name, ID number, average test score, and course grade...

These are the instructions, from what I understand, I think it should look like this...

ask for students...
ask for test scores..
build arrays

student 1: ID? name?
test1:
test2:

student2: ID?Name?
test1:
test2:


something like that...help!!!

pt_solar
Newbie Poster
23 posts since Mar 2009
Reputation Points: 10
Solved Threads: 0
 

That looks suspiciously like a homework question. Perhaps you should give a shot at coding it a bit yourself before we give you a hand.

ShawnCplus
Code Monkey
Team Colleague
1,583 posts since Apr 2005
Reputation Points: 526
Solved Threads: 268
 
I have a very hard programming challenge and i need help... I have nothing so far, so im hoping somebody could help me build it...


> Doesn't sound very difficult :)

> Sure we can help you as long as you can show us what you've already done and ask us specific questions about what you don't understand ...

tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
 

Okay I will try thanks

pt_solar
Newbie Poster
23 posts since Mar 2009
Reputation Points: 10
Solved Threads: 0
 

this assignment has never been given before!!!!11

jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179
 

> Whether it's his homework or not, he'll first have to show us his code :) ...

tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
 

I would sugguest attending class.

skatamatic
Posting Shark
959 posts since Nov 2007
Reputation Points: 403
Solved Threads: 129
 

Poor me ! it's an online class, it was the only option and the teacher sucks. We have a tutor that's a fellow student and he couldn't even help me do this one . So please help with whatever hints you can give me Here's what I have:

#include <iostream>
using namespace std;

const int NAME_LENGTH= 80;
const int SIZE;

struct studentData
{
char studentName[NAME_LENGTH];
int Idnum;
int numTests;
int *testsPtr;
double Average;
char Grade[SIZE];
};

int main()
{
cout<<"How many test scores are there?"<<endl;
cin>> numTests;

cout<< "How many students are there?"<<endl;
cin<< numStudents;

studentData *students;
students = new student[numStudents];
for (int count=0; count<numStudents;count++)
{
cout<<"Enter the Test scores for student number "<<(count+1)<<endl;
for (int count=0; count<Tests; count++)
{
cout<< "Enter test score #"<<(count+1)<<": "endl;
cin>> Tests[count]

pt_solar
Newbie Poster
23 posts since Mar 2009
Reputation Points: 10
Solved Threads: 0
 

Okay I guess my first question is how do I dynamically allocate an array of structures correctly and how do I get each structure's tests to point to a dynamically allocated array that hold these test scores?
I have no idea hat to do from here on Please help:

#include <iostream>
using namespace std;

const int NAME_LENGTH= 80;
const int SIZE;

struct StudentData
{
char studentName[NAME_LENGTH];
int Idnum;
int numTests;
int *testsPtr;
double Average;
char Grade[SIZE];
};

int main()
{
cout<<"How many test scores are there?"<<endl;
cin>> numTests;

cout<< "How many students are there?"<<endl;
cin<< numStudents;

StudentData *testsPtr;
testsPtr = new StudentsData[numStudents];
for (int count=0; count<numStudents;count++)
{
cout<<"Enter the Test scores for student number "<<(count+1)<<endl;
for (int count=0; count<Tests; count++)
{
cout<< "Enter test score #"<<(count+1)<<": "endl;

pt_solar
Newbie Poster
23 posts since Mar 2009
Reputation Points: 10
Solved Threads: 0
 

Is this the total number of test scores for ALL students combined or for EACH student?

cout<<"How many test scores are there?"<<endl;
	cin>> numTests;


And does each student have the same number of test scores or does it vary from student to student? Also, what does SIZE represent here?

const int SIZE;
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711
 

The number of test scores for every individual student. And that's a mistake that I just realized I don't need SIZE there . I'm so lost with this question...

pt_solar
Newbie Poster
23 posts since Mar 2009
Reputation Points: 10
Solved Threads: 0
 
The number of test scores for every individual student. And that's a mistake that I just realized I don't need SIZE there . I'm so lost with this question...

O.K. Again, does each student have the same number of test scores?

VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You