Difficult programming challenge

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Mar 2009
Posts: 23
Reputation: pt_solar is an unknown quantity at this point 
Solved Threads: 0
pt_solar pt_solar is offline Offline
Newbie Poster

Difficult programming challenge

 
0
  #1
Apr 28th, 2009
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!!!
Last edited by pt_solar; Apr 28th, 2009 at 1:28 pm.
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 1,402
Reputation: ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light 
Solved Threads: 224
Sponsor
ShawnCplus's Avatar
ShawnCplus ShawnCplus is offline Offline
Code Monkey

Re: Difficult programming challenge

 
0
  #2
Apr 28th, 2009
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.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 1,968
Reputation: tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute 
Solved Threads: 214
tux4life's Avatar
tux4life tux4life is offline Offline
Posting Virtuoso

Re: Difficult programming challenge

 
0
  #3
Apr 28th, 2009
Originally Posted by pt_solar View Post
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 ...
"Never argue with idiots, they just drag you down to their level and then beat you with experience."
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 23
Reputation: pt_solar is an unknown quantity at this point 
Solved Threads: 0
pt_solar pt_solar is offline Offline
Newbie Poster

Re: Difficult programming challenge

 
0
  #4
Apr 28th, 2009
Okay I will try thanks
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 1,602
Reputation: jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of 
Solved Threads: 120
jephthah's Avatar
jephthah jephthah is offline Offline
Posting Virtuoso

Re: Difficult programming challenge

 
0
  #5
Apr 28th, 2009
this assignment has never been given before!!!!11
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 1,968
Reputation: tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute 
Solved Threads: 214
tux4life's Avatar
tux4life tux4life is offline Offline
Posting Virtuoso

Re: Difficult programming challenge

 
0
  #6
Apr 28th, 2009
> Whether it's his homework or not, he'll first have to show us his code ...
"Never argue with idiots, they just drag you down to their level and then beat you with experience."
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 390
Reputation: skatamatic will become famous soon enough skatamatic will become famous soon enough 
Solved Threads: 39
skatamatic skatamatic is offline Offline
Posting Whiz

Re: Difficult programming challenge

 
0
  #7
Apr 28th, 2009
I would sugguest attending class.
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 23
Reputation: pt_solar is an unknown quantity at this point 
Solved Threads: 0
pt_solar pt_solar is offline Offline
Newbie Poster

Re: Difficult programming challenge

 
0
  #8
Apr 28th, 2009
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]
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 23
Reputation: pt_solar is an unknown quantity at this point 
Solved Threads: 0
pt_solar pt_solar is offline Offline
Newbie Poster

Re: Difficult programming challenge

 
0
  #9
Apr 28th, 2009
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;
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,813
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 501
Featured Poster
VernonDozier VernonDozier is offline Offline
Senior Poster

Re: Difficult programming challenge

 
0
  #10
Apr 29th, 2009
Is this the total number of test scores for ALL students combined or for EACH student?

  1. cout<<"How many test scores are there?"<<endl;
  2. 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?

  1. const int SIZE;
Last edited by VernonDozier; Apr 29th, 2009 at 1:09 am.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC