R
Richard
Define a record structure to hold a set of test scores,
number of tests, and the average score. The number of
records are to be determined at runtime. Also the
number of tests for each record is to be determined at
runtime. Calculate the average test score for the set
the set of test scores in each record. Display records.
Demonstrate with a least five records. I do not know how to dynamically
allocate the number of record and the number of test scores. I can anyone
show me this first step. The rest of the program should be easy for me.
Thanks
Here is my code for dynamcally allocated number of records and test scores
in a structure.
# include <iostream>
# include <string>
using namespace std;
// structure declaration
struct student_info
{
char name[20];
int test_scores;
float average_ts;
};
// function prototypes passing structure into function
void main()
{
int student_record=0, number_test_scores, number_of_student;
cout<<"How many student do you want to average test scores? : ";
cin >>student_record;
student_info student[student_record];
student_record = new int[number_of_student];
cout<<"How many test scores do you want to calculate average for this
student? : ";
cin >>number_test_scores;
}
number of tests, and the average score. The number of
records are to be determined at runtime. Also the
number of tests for each record is to be determined at
runtime. Calculate the average test score for the set
the set of test scores in each record. Display records.
Demonstrate with a least five records. I do not know how to dynamically
allocate the number of record and the number of test scores. I can anyone
show me this first step. The rest of the program should be easy for me.
Thanks
Here is my code for dynamcally allocated number of records and test scores
in a structure.
# include <iostream>
# include <string>
using namespace std;
// structure declaration
struct student_info
{
char name[20];
int test_scores;
float average_ts;
};
// function prototypes passing structure into function
void main()
{
int student_record=0, number_test_scores, number_of_student;
cout<<"How many student do you want to average test scores? : ";
cin >>student_record;
student_info student[student_record];
student_record = new int[number_of_student];
cout<<"How many test scores do you want to calculate average for this
student? : ";
cin >>number_test_scores;
}