Accept input and produce output in the same manner

Assignment Help Computer Engineering
Reference no: EM132217501

Given a data set of up to 25 integers, determine if there is a constant value which separates every element. Display the value when it exists and the data set in sorted order.

The ouput should print exactly as the sample executions.

Example Execution #1:
Enter up to 25 values or -1 to exit: 10 8 6 4 2 16 14 12 -1

Constant value 2 separates the elements: 2 4 6 8 10 12 14 16
Example Execution #2:

Enter up to 25 values or -1 to exit: 2 4 6 8 10 1 3 5 7 9 -1 Constant value 1 separates the elements: 1 2 3 4 5 6 7 8 9 10
Example Execution #3:

Enter up to 25 values or -1 to exit: 6 16 26 36 31 21 11 -1 Constant value 5 separates the elements: 6 11 16 21 26 31 36
Example Execution #4:

Enter up to 25 values or -1 to exit: 1 2 3 4 5 10 9 8 7 -1 No constant value that separates the elements.
Example Execution #5 (-1 not needed to terminate input when 25 elements are present in the data set):

Enter up to 25 values or -1 to exit: 10 20 30 40 50 60 11 21 31 41 51 1 2 3 4 5 12 13 14 15 16 8 7 6 9 10 No constant value that separates the elements.
Example Execution #6:

Enter up to 25 values or -1 to exit: 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 -1 Constant value 1 separates the elements: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Example Execution #7:

Enter up to 25 values or -1 to exit: 1 6 12 18 24 -1 No constant value that separates the elements.

Each example execution represents a single test of your program. Your program is expected to accept input and produce output in the same manner demonstrated above. Your program will always be tested with non-negative values that can be stored in an int variable. Do not add any "bonus" features not demonstrated in the example executions provided.

With our ability to implement user-defined functions only the following will be permitted in the main function:

Declaration of variables to be passed to functions.

Calls to user-defined functions by main.

A limited amount of control structures (see chapters 5 and 6) to retain the previous two tasks within the main

function.

Additionally, each user-defined function may represent a single task in your larger program. The failure to make a good use of user-defined functions as described here and in the course standards will result in a loss of ALL points on those assignments that require user-defined functions.

Reference no: EM132217501

Questions Cloud

Provide runtime analysis of your program : Provide runtime analysis of your program. As discussed in lecture, Big-O notation provides us a way to evaluate the performance of our code.
Compute the average of the given numbers : Compute the average of these numbers, when you are finished all numbers should be removed from the stack and the average should be stored in EAX.
Create a new xslt style sheet document : The Downtown Zoo has hired you to help work on their web site. They would like to create a page that displays the times that various animals are being fed.
Estimate the value of the mathematical constant e : Write a program that calls MyFact and estimates the value of the mathematical constant e by using the formula.
Accept input and produce output in the same manner : Given a data set of up to 25 integers, determine if there is a constant value which separates every element.
Write a new method that receives the ages array : Write a new method called printArray that receives the ages array and prints the content of the array separated by commas.
Produce a program that sorts a list of numbers in ascending : Your job is to produce a program that sorts a list of numbers in ascending order. Your program will need to read-in, from a file, a list of integers.
Evaluate the use of post-loss risk transfer mechanisms : Advanced risk financing and transfer - To enable candidates to understand the role that risk financing and risk transfer play in risk management
Write out the algorithm on paper of how you propose : If a user enters one of these values, you are to print out the channel number along with its network affiliation.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd