Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

Students also viewed these Databases questions