Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write in code in C++: General requirements: - No global variables - No multiple return statements in one function - Show how you have tested

Write in code in C++:

General requirements: - No global variables - No multiple return statements in one function - Show how you have tested these functions - You can use cin and cout in this function but please do not print out the results. It should return the values to the caller through the use of return type and pass-by-reference parameters. - Please do not use tuple or pair class. Please use only pass-by-reference parameters and return type to return values to the caller. - Please do not use arrays. Please use only simple variables to keep track of the information. Note: this is an exercise to use functions and not array. Question #1:

Write a function named "countBetween" that reads in from the user a list of numbers until the user re-enters the first number. It will return the count of how many numbers between the first numbers. In addition, it returns a boolean flag that indicates whether the numbers in between are all more or less than the first number but not both.

For example, if the user enters 10, 10, it will return 0 and false. If the user enters 10, 30, 40, 10 it will return 2 and true (all numbers are more than the first number) If the user enters 10, 20, 30, 5, 10, it will return 3 and false. If the user enters 50, 10, 40, 30, 50, it will return 3 and true (all numbers are less than the first number) If the user enters 0, 10, 0, it will return 1 and true.

Question #2:

Write a function named "countGrades" that will accept a count as the total number of grades to be read in by the function. After reading the list of grades, it will return the following statistical data for that list of grades: - how many grades are passing ('A' or 'B' or 'C') - how many 'A' grades - how many invalid grades (not 'A', 'B', 'C', 'D' or 'F')

For example, if the user passes in 1 and enters 'A', it will return 1, 1, 0 If the user passes in 3 and enters 'A', 'B', 'C', it will return 3, 1, 0 If the user enters in 5 and enters 'A', 'B', 'C', 'X', 'A', it will return 4, 2, 1

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

Database And Expert Systems Applications 24th International Conference Dexa 2013 Prague Czech Republic August 2013 Proceedings Part 2 Lncs 8056

Authors: Hendrik Decker ,Lenka Lhotska ,Sebastian Link ,Josef Basl ,A Min Tjoa

2013th Edition

3642401724, 978-3642401725

More Books

Students also viewed these Databases questions

Question

1. Explain how business strategy affects HR strategy.

Answered: 1 week ago