Display the positive even numbers

Assignment Help Basic Computer Science
Reference no: EM131218125

The following code is supposed to display the positive even numbers less than 12. That is, it will output the numbers 2, 4, 6, 8 and 10. However, there is a logical error in the code. Explain what the output of the code below will be. Then write a small program including the code below and make the necessary changes to fix the code so that it displays what it is intended to display. Ensure that your program works correctly. Only submit the program, not the output. Hint: Use variable diagrams to trace the program to help you find the logical error.

int x = 1;

while (x != 12)

{

cout << x << endl;

x = x + 2;

Reference no: EM131218125

Questions Cloud

Two figures from the humanities : Write a paper and include two figures from the Humanities.-  compare and contrast their achievements.
Begin with a workstation running : A suggested approach is to begin with a workstation running a web browser and trace a connection to a public web server (i.e. facebook; eBay; etc). As part of your narrative
What is involved in performing the eight key managerial task : Explain what role a company's culture plays in executing these managerial tasks.
File size-transmission speed and transmission time : Cloud 9, a cloud storage service provider based in San Diego, has just announced that it is running out of money and will be shutting down operations soon. It has given all its clients fifteen (15) days to move their data out, either back to their..
Display the positive even numbers : The following code is supposed to display the positive even numbers less than 12. That is, it will output the numbers 2, 4, 6, 8 and 10. However, there is a logical error in the code. Explain what the output of the code below will be.
Schedule deliveries from its central warehouse : Sherry's Meats, a regional meat wholesaler and retailer, needs to collect up-to-date information on how much of each meat product it has in each store. It will then use that information to schedule deliveries from its central warehouse.
What are a trade deficit and a trade surplus : What are a trade deficit and a trade surplus? What are the implications of a long-term trade deficit or trade surplus? What techniques are available to correct Balance of Payment Deficit or Surplus?
Barlow declaration of independence : How is Barlow's declaration of independence similar and different from theDeclaration of Independence (Links to an external site.)that Thomas Jefferson wrote in 1776 in terms of what each wanted to achieve for the "people" or to empower them?
What are the elements of capital budgeting : What are the elements of capital budgeting? How do you determine these elements in the global business arena? Provide examples of how you would use capital budgeting analysis to determine the desirability of global projects.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Data mining for business decisions

Randall Parman, database architect at restaurant chain Applebee's International and head of Teradata's user group, opened Teradata's annual user conference in Las Vegas with a warning to those who aren't making the best use of their data. "Data ar..

  Write a program to measure latency of communication

If you have access to an SMP and a cluster, write a program to measure latency of communication and bandwidth of communication between processors, as was plotted in Figure F.32 on page F-80.

  Who delivers supplies to its customer

In what ways does IT planning help managers exercise control in a situation? Does IT impact the truck driver of a company who delivers supplies to its customer?

  Define the internet as part of a business solution

Assess the probable difficulties and risks associated with using a public infrastructure such as the Internet as part of a business solution.

  Determine the date in opening the letter from same file

if /home/jenny/draft and /home/Alex/letter are relates to same file and the following sequence of events occurs, determine the date in opening the letter?

  Vb script

Your company is currently planning to automate many different system administration tasks. Your manager has asked you to research a system administration task and implement it using VBScript. In addition, your manager would like to see both a proposa..

  What is a constructor

What is a constructor? Give its properties. How do we declare/ define it? Can they be overloaded?

  Determine the bending moment at the midpoint of the bow

At full draw, an archer applies a pull of 130 N to the bowstring of the bow shown in the figure. Determine the bending moment at the midpoint of the bow

  Modify the binary search tree to support

Suppose we want to add the operation findKth to our repertoire. The opera- tion findKth(k) returns the kth smallest item in the tree. Assume all items are distinct. Explain how to modify the binary search tree to support this opera- tion in O(log ..

  Which tool would be best-suited for this

Your computer running Windows 7 is doing some very strange things with the operating system. You are fairly certain it is not a hardware issue. You need to try to get further insight into what is going on within the operating system. Which tool wo..

  Create an initial world with four spotlights

When the user clicks on a spotlight, pass the color of the spotlight to the method and make the snowman change to be that color.

  Organizational risk appetite and risk assessment

Imagine that a software development company has just appointed you to lead a risk assessment project. The Chief Information Officer (CIO) of the organization has seen reports of malicious activity on the rise and has become extremely concerned wit..

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