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

  What is off-chip inter-connect delay

What is off-chip inter-connect delay? What has been the impact of this increase on the way parallel processing systems are designed?

  What is the value of pc before you execute the jal

Write a 2-3 sentence summary describing how the PC and $ra registers change when a subroutine is called and when we return from a subroutine.

  Program the user types an item number and a quantity

I need a program for a mail-order company. The program uses a data-entry screen in which the user types an item number and a quantity. Write each record to a file. Save program as MailOrderWrite.java

  How can we get around this problem given below

The arrayBagStack structure is in the .h file and therefore exposed to the users of the data structure. How can we get around this problem?

  Define ?what could have been done to prevent this attack

?What could have been done to prevent this attack. Why weren't these steps taken initially

  How many recursive calls need to be made

How many recursive calls need to be made so that the algorithm will have an asymptotic running time of Theta (n3)?

  Explain how to use an avl tree or a red-black tree to sort n

Explain how to use an AVL tree or a red-black tree to sort n comparable elements in O(nlogn) time in the worst case.

  Make a java application containing an array

design a JApplet with a JButton labeled "Who's number one?". When the user clicks the button, display your favorite sports team. Save the file as JNumberOne.java .

  Which of the following is not a task characteristic

A technique that uses optimistic, pessimistic, and realistic time to calculate the expected time for a particular task best defines.

  Define organizations access control policy

Research how organizations Access Control Policy builds enforcement measures to ensure their access control system is effective and safe.

  What is your opinion about sqa plan

More project teams are having software quality assurance plan done when they develop projects.

  What are the systems perceived deficiencies

What are system's perceived deficiencies? What changes can you propose to improve perceived deficiencies? What data and processes will be affected by these changes? What changes in procedures and policies will be required?

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