Hello Im trying to figure out how to do what the title says.
Here is what my structure looks like -
//Structure for the Student Recored
-
struct studentRecord
-
{
-
int studentID;
-
string first_name;
-
string last_name;
-
int quiz1;
-
int quiz2;
-
int midTerm;
-
int finalExam;
-
int totalPoints;
-
double percentTotal;
-
char letterGrade;
-
};
-
The only data that will need to be assigned will be the: - studentID, quiz1, quiz2, midTerm, finalExam,
because these are variables the user will input.
Also i need to be able to process multiple records, because more than one student will be entered. So my question about this is do i need to change my structure?
Please help!
Thank you.
11 2157 gpraghuram 1,275
Recognized Expert Top Contributor
Hello Im trying to figure out how to do what the title says.
Here is what my structure looks like -
//Structure for the Student Recored
-
struct studentRecord
-
{
-
int studentID;
-
string first_name;
-
string last_name;
-
int quiz1;
-
int quiz2;
-
int midTerm;
-
int finalExam;
-
int totalPoints;
-
double percentTotal;
-
char letterGrade;
-
};
-
The only data that will need to be assigned will be the: - studentID, quiz1, quiz2, midTerm, finalExam,
because these are variables the user will input.
Also i need to be able to process multiple records, because more than one student will be entered. So my question about this is do i need to change my structure?
Please help!
Thank you.
The only data that will need to be assigned will be the: - studentID, quiz1, quiz2, midTerm, finalExam,
because these are variables the user will input.
from where you will get other data?
Also i need to be able to process multiple records, because more than one student will be entered.
You can have array of these structures or a vector of this structure
Raghuram
gpraghuram 1,275
Recognized Expert Top Contributor
You calculate yhe percenttotal like this -
percentTotal = ((totalPoints / totalPointsPossible) * 100);
-
but the totalPoints and totalPointsPossible are both ints and you wont have the decimal part for this.
Raghuram
Yes thanks, i changed those to double, so they would work properly.
Now need to figure out the rest!
I would like to use an array, but is there a way to have it automatically figure out how many entries there are? Cause they may vary each time
Would i need something like - const int number_of_students = (somehow add all entries together after confirming finish)
-
then the array would be like - int i, score[number_of_students], max;
For the numbers of students, just have a variable inside a loop increment every time the loop restarts.
For the high and low points, use an if statement to determine whether or not the total points is higher or lower than the previous one and store the new value it if it is.
For the average, just keep adding the total points every loop then divide it by the number of students.
Just some ideas, trying to figure out how to do them correctly.
Opps double post meant to edit.
gpraghuram 1,275
Recognized Expert Top Contributor
You can have a dynamic array to hold the same like -
int *score = (int*)malloc(sizeof(struct) *number_of_students)
-
Raghuram
would that go under int main()?
gpraghuram 1,275
Recognized Expert Top Contributor
would that go under int main()?
You can have it there...
But this address has to be passed to the calling function if you are changing the values inside the calling function.
Raghuram
So should i go ahead and make another void function, bear with me here, like i said im just learning this stuff.
Thanks
gpraghuram 1,275
Recognized Expert Top Contributor
So should i go ahead and make another void function, bear with me here, like i said im just learning this stuff.
Thanks
You can do that way also, but if you are writing the code in main function itsef.
Better write the code and post me, so i can take a look into it
Raghuram
You can do that way also, but if you are writing the code in main function itsef.
Better write the code and post me, so i can take a look into it
Raghuram
I need a new structure first, but how does it determine how many entries to save, since it may change each time?
Also the program must prompt the keyboard operator to determine whether there is another student to be processed, if not, display results, but i cant figure out what i need to do for this part.
So far heres what i have,
The Structure - struct allstudentRecord
-
{
-
int totalStudents;
-
int highestPoints;
-
int lowestPoints;
-
int avgTotalPoints;
-
char avgLetterGrade;
-
-
};
Then i create a void - void get_allData (allstudentRecord& allthe_student)
-
{
-
int *allthe_student.score = (int*)malloc(sizeof(struct) *allthe_student.totalStudents)
But i got stuck here cause the declaration of allthe_student shadows a parameter. So im not sure what to do.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Michael Easterly |
last post by:
What is a good way to read a text file and read each line, then assign
data to variables? I have this so far,
#include <iostream>
#include <fstream>
using namespace std;
string...
|
by: Lynn |
last post by:
I am rewriting some memory management code and I need to have a forward
declaration of a data structure. I am not converting this data structure into a
class (yet). How do I generate a forward...
|
by: theshowmecanuck |
last post by:
As a matter of academic interest only, is there a way to programmatically
list the 'c' data types? I am not looking for detail, just if it is
possible, and what function could be used to...
|
by: Brent |
last post by:
I have variables in a structure loaded into a list box.
I thought I could use FieldInfo.SetValue to update the items value when the
user clicks on it, but it is not working.
..
..
..
Dim fi...
|
by: Jon |
last post by:
This seems strange, but maybe there's some basic concept I'm missing.
When I assign one class member to another, any methods that are applied
to one are applied to both variables.I can't get the...
| |
by: mangalalei |
last post by:
A static data member can be of the same class type as that of which it
is a member. A nonstatic data member is restricted to being declared as
a pointer or a reference to an object of its class.
...
|
by: Calle Pettersson |
last post by:
Coming from writing mostly in Java, I have trouble understanding how to
declare a member without initializing it, and do that later... In Java,
I would write something like
public static void...
|
by: =?Utf-8?B?Umljb2hEZXZlbG9wZXI=?= |
last post by:
I have a class library project that uses unmanaged C dll to perform some
image handling. This DLL requires me to pass in a structure containing image
coordinates. In VB6, I could use a...
|
by: =?Utf-8?B?VHJlY2l1cw==?= |
last post by:
Hello, Newsgroupians:
I have a large class with a lot of member variables. I also have a function
in the class that I would like to change ALL Of the member variables. I am
trying to assign...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |