Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program such that the sequential input entered by the user is summed or counted, up until the end criteria is seen in the

Write a program such that the sequential input entered by the user is summed or counted, up until the end criteria is seen in the sequence. The end criteria is also defined by the user. No previous information about where the entered sequence is reached to the stop criteria. Both stop criteria and function type is defined by the user inputs in the main function and necessary information is passed to the proper function.

As an example, if sum function is chosen with stop criteria 0, and user starts to enter one by one the values 1,2,3,0 in order, the program should stop receiving input immediately whenever the 0 (defined stop criteria) is entered and print out 6 as sum of inputs up to stop criteria.

In another case, if -1 is chosen as stop criteria and the count function is chosen by the user, as an example, and the sequence one by one entered is the 3,2,5,1,-1, the program should print 4 to the screen as a number of inputs up to -1 entered.

Dont forget the sequence is entered one by one (1, enter, 2, enter, 3, enter, 0, enter is the sequence of user in the first example).

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 Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions