Question: Given this code: struct Student { char name[30]; int scores[10]; }; a) Write a function that returns a dynamic array of structure pointers of certain
Given this code:
struct Student {
char name[30];
int scores[10];
};
a) Write a function that returns a dynamic array of structure pointers of certain given size. Each struct data should contain random student names (size 2, one single letter followed by 1 random number) and SCORES_SIZE (10) random student scores that have the range from 0 to maxScore. No "cout" in function. It is OK to use "stringstream" in this function.
Student** getRandomStudents(int stCount, int maxScore);
b) Write a function that prints students from a dynamic array. Student scores are random, from 0 up to a maximum value. Must use "cout" in function.
void printStudents(Student** students, int stCount);
Outputs look similar to this:
Student name: A123
Scores: 10 18 20 19 5 17 11 18 5 12
Student name: D67
Scores: 17 19 20 11 5 17 11 13 5 12
Student name: X347
Scores: 10 18 20 19 15 19 18 12 15 12
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
