Write a program that should calculate and report the sum

Assignment Help Computer Engineering
Reference no: EM132208466

Question :

1. Write a program that should calculate and report the sum of all the integers between and including two integers. For instance, if the user enters 2 and 9, the program would report that the sum of all the integers from 2 through 9 is 44. (What happens if the user enters 9 and 2 instead of 2 and 9?) You need to make sure the program operates correctly in both cases. Make sure your program also works for negative integers.

2. You need to have a main and 2 other functions for this program.

3. One function needs to read in the two values and return them back to the main function. You need to use pass by reference to do this.

4. The second other function needs to calculate the sum of all of the values between the two integers. You will need to pass the two integers to the function and return the sum back to main.

5. You main function needs to have a processing loop. Within the loop you need to call the function that reads in the two integer values. If both of the integer values are 0 you need to stop processing your loop. If the values returned are not both 0 you need to call the function that calculates the sum.

6. Finally you need to display the two input values and the sum and continue with the main processing loop.

The computer language is C++. I am confused about number 3: returning two values from one function back to main because I didn't think it was possible to return two values. I'm probably just overthinking it; it's been awhile since I have dealt with passing by reference.

Reference no: EM132208466

Questions Cloud

Calculate and print the bill for cellular telephone company : Write a program that calculates and prints the bill for a cellular telephone company. The company offers two types of service: regular and premium.
Accept one string argument and returns the reverse : A recursive function called printReverse that accepts one string argument and returns the reverse of that string.
Simulate the rolling of a pair of dice 1000 times : Write a program that calls a method RollDie that simulates the rolling of a pair of dice 1000 times. Use an array of size 11 to keep track of the rolls.
Write a program that calculate taxi fare at a rate : Write a program that calculate taxi fare at a rate of $1.5 per mile. Your program should interact with the user in this manner.
Write a program that should calculate and report the sum : Write a program that should calculate and report the sum of all the integers between and including two integers.
Count the number of characters in a null-terminated : Write a program called COUNT to count the number of characters in a null-terminated ASCII string that are equal to a KEY.
How many btus of heat are delivered to a house given : Write a program that calculates how many BTUs of heat are delivered to a house given the number of gallons of oil burned and the efficiency of the house's oil.
Discussion of the implications and limitations of the study : A researcher has been given the task of identifying factors that influence children's performance on reading tests at the end of primary schooling
How many bottles of merlot will cao yawen buy : Assune CAO Yawen's passion is fine wine. When the prices of all fixed at current levels, CAO Yawen's demand function for highquality merlot is q other goods.

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