Question: 2.) Create codes for the following questions on getting scores and amounts in C++ language. A) Write a function GetScores(...) that is given a string,

2.) Create codes for the following questions on getting scores and amounts in C++ language.

A)

Write a function GetScores(...) that is given a string, an int type array to fill and the max number of elements in the array as parameters and returns an integer result. The function will find each substring of the given string separated by space characters and place it in the array. The function returns the number of integers extracted.

For example: GetScores("123 456 789", int values[], int max_values ) would return the count of 3 and fill the array with integers 123, 456, 789.

B)

Write a function GetAmounts(...) that is given a string, an array to fill and the max number of elements in the array as parameters and returns an integer result. The function will separate each substring of the given string between space characters and place it in the array.. The function returns the number of values extracted.

For example: GetAmounts("1.23 4.56 7.89", float values[], int max_values ) would return the count of 3 and fill the array with floating point values 1.23, 4.56, 7.89.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!