Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions