please everyone feel free to respond.
am posting an assignment that i was given in lab. i have been working on this for two days now. am not aking for the solution, I need serious guidance. i can write the structure but i get stuck when writing the functions. this the assignment below.
In this assignment, you will write a complete C++ program that simulates a small student database.
First define a structure (record) student to represents students with the following information:
Student ID number
Test1 … Test2 grades out of 100
Letter grade
Write a function Display that displays on the screen a student.
Write a function Read that reads in a student from the keyboard and return it.
Write a function Compute that takes a student and computes the letter grade based on his/her tests’ grades (100>= A >90; 90 >= B > 80; 80 >= C > 70; 70 >= D > 60; 60 > F ).
Then write the main function in order to test each of the above functions. For this purpose, you will declare an array of student called MiniClass of size 2.
QUESTION: when it says declare array of student of miniclass of size 2, why does it have to be a size 2? does that mean two different students or just two different grades?
ok this is what i have so far.............
enum gradetype {A, B,C,D,F};
struct student{
int idnumber;
int testgrade;
gradetype coursegrade;
};
void display(student&)
I KNOW its pathetic but thats as far as i have gotten sucessfully. with the void funtion am not even sure what am suppose to after that step. i think Display and Compute ought to be void functions and Read a value function.
pleaseEEEEE SOMEONE HELP!!!! Thanks so much in advance.
3 1475 Banfa 9,065
Expert Mod 8TB
QUESTION: when it says declare array of student of miniclass of size 2, why does it have to be a size 2? does that mean two different students or just two different grades?
2 because you prof said so just to limit the scope of the problem and it means 2 students. That is why it is called MiniClass because a class with only 2 students in it would be very small in deed.
ok this is what i have so far.............
enum gradetype {A, B,C,D,F};
struct student{
int idnumber;
int testgrade;
gradetype coursegrade;
};
Your original post gives the impression that each student should have 2 test grades, not a single test grade as you have given them, these will be combined into a single course grade.
void display(student&)
I KNOW its pathetic but thats as far as i have gotten sucessfully. with the void funtion am not even sure what am suppose to after that step. i think Display and Compute ought to be void functions and Read a value function.
pleaseEEEEE SOMEONE HELP!!!! Thanks so much in advance.
This looks about right -
void display(const student &student)
-
{
-
// Code to display student data using printf or cout
-
}
-
-
void compute(student &student)
-
{
-
// Code to calculate course grade from test grades
-
}
-
-
student read(void)
-
{
-
// Code read student data from stdin using cin or fgets
-
}
-
2 because you prof said so just to limit the scope of the problem and it means 2 students. That is why it is called MiniClass because a class with only 2 students in it would be very small in deed.
Your original post gives the impression that each student should have 2 test grades, not a single test grade as you have given them, these will be combined into a single course grade.
This looks about right -
void display(const student &student)
-
{
-
// Code to display student data using printf or cout
-
}
-
-
void compute(student &student)
-
{
-
// Code to calculate course grade from test grades
-
}
-
-
student read(void)
-
{
-
// Code read student data from stdin using cin or fgets
-
}
-
thanks for the reply, but am still confused. i kind of knew this part. what i dont understand is how the array ties in to this. i understand the different parts of the program i just dont know how am suppose to make it work together as one.
Banfa 9,065
Expert Mod 8TB
thanks for the reply, but am still confused. i kind of knew this part. what i dont understand is how the array ties in to this. i understand the different parts of the program i just dont know how am suppose to make it work together as one.
Oh sorry so a simple main might look something like -
#define NUM_SUDENTS 2
-
-
int main(int argc, char **argp)
-
{
-
students MiniClass[NUM_SUDENTS];
-
int ix;
-
-
for(ix=0; ix<NUM_SUDENTS; ix++)
-
{
-
MiniClass[ix] = read();
-
compute(MiniClass[ix]);
-
}
-
-
for(ix=0; ix<NUM_SUDENTS; ix++)
-
{
-
display(MiniClass[ix]);
-
}
-
}
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Eric Kincl |
last post by:
OK, another quickie,
How do I pass an array to a function? This is what I have, and the second
function doesn't seem to be getting the array somehow. I'm sure it's in
the function declaration......
|
by: Laura |
last post by:
Help. Below is my code. Getting Type mismatch error on
the noted line. I'm trying to send an array (aryNewD)
with 4 columns and x rows to a function to save all the
array info into a SQL Server...
|
by: Henry |
last post by:
Hi,
I need to pass an array to a function, change it a little and return it to
the main code. When i try it the webpage is displayed up until the function
call. Nothing after that is displayed....
|
by: fivelitermustang |
last post by:
I have two matrices allocated dynamically in both directions: matrix x and
matrix v.
I want to pass these matrices into a function by reference. What I have
written down isn't working... can...
|
by: dave.harper |
last post by:
I'm relatively new to C++, but have a question regarding functions and
arrays. I'm passing a relatively large array to a function several
thousand times during the course of a loop, and it seems...
|
by: coinjo |
last post by:
How to pass a full array into a function?
|
by: viggu |
last post by:
how to pass arrays into the function and what is the use of functions.what do you mean by a modification of the array values in the function and does the modification of the values occur only inside...
|
by: rainy6144 |
last post by:
Does the following code have defined behavior?
double *new_array(unsigned n)
{
double *p = malloc(n * sizeof(double));
unsigned i;
for (i = 0; i < n; i++) p = 0.0;
return p;
}
|
by: Art Cummings |
last post by:
Good morning all. I just finished an assignment using structures. In this
assignment I used an array of structures. What I would have liked was to
use an array of structures with a function. ...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| | |