Write a program that displays the cubes of the numbers

Assignment Help C/C++ Programming
Reference no: EM13338779

Repetition Statements

Write a program that displays the cubes of the numbers from 1 to 10. Recall that the cubes of a number is just the number multiplied by itself and then by itself again. Demonstrate your knowledge of both looping structures by writing two procedures to do this. One procedure should be called, cubeFor and the other should be called, cubeDoWhile. Each procedure should take no arguments and return no values. Inside the procedure, simply display a message telling what kind of loop it is using and then use the appropriate loop to display the number, followed by its cubed value.

When you finish writing these two procedures, write a main procedure that will call both cubeFor and cubeDoWhile to show that they work.
Although the output from your program is not required to look this way, it might look something like:

The cubes using a for statement are:
1 1
2 8
3 27
4 64
5 125
6 216
7 343
8 512
9 729
10 1000

The cubes using a do...while statement are:
1 1
2 8
3 27
4 64
5 125
6 216
7 343
8 512
9 729
10 1000

Reference no: EM13338779

Questions Cloud

Design a wide area network : Design a wide area network (WAN) between offices that includes appropriate math calculations to meet the bandwidth.
Find the electric field as a function of r outside sphere : An aluminum wire has a length of 20m and adiameter of 0.0025in. It is connected to a 9.35V battery. The resistivity of aluminium is 2.65x10^-8(ohm(m))a).
Analyze richardson message from multiple perspectives : Analyze Richardson's message from multiple perspectives, focusing on word choice and content
Determine the total force the person must apply : A person is pushing a uniformly-loaded 21.65 kg wheelbarrow along a plank that makes an angle ? = 27.0° with the horizontal. What is the total force the person must apply
Write a program that displays the cubes of the numbers : Write a program that displays the cubes of the numbers from 1 to 10. Recall that the cubes of a number is just the number multiplied by itself and then by itself again.
Find the magnetic vector potential inside and outside a slab : Find the magnetic vector potential inside and outside a slab of thinkness 2a, extending infinitely in x and y directions. Use Coulomb's gauge. J= -J e^-abs(z)/a)
Find the capacitance that satisfies the design criteria : You're designing a speaker, and you want the tweeter to handle almost everything above 1100 Hz, and woofer to handle almost everything below Hz. Find the capacitance that satisfies the design criteria
Write a program to print the permutation : Given an integer n and a permutation of numbers 1, 2 ... , n-1, n write a program to print the permutation that lexicographically precedes the given input permutation.
Create a non-gui based java application : Create a non-GUI based Java application that calculates weekly pay for an employee. The application should display text that requests the user input the name of the employee.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Dynamically allocates an array large enough

Write a program that dynamically allocates an array large enough to hold a number of test score. The size of the array should be input by the user

  Implement the readlog function

Implement the readLog function below, which is to (1) read the file, (2) populate a vector for each column, and (3) return the number of lines found.

  Create class has three pieces of information as data members

Create a class called Date in C++ that includes three pieces of information as data members: month (type int), day (type int) and yaer (type int).

  Write a program that prompts the user to input

One metric ton is approximately 2205 pounds. Write a program that prompts the user to input the amount of rice, in pounds, in a bag. The program outputs the number of bags needed to store one.

  A linked list of your song structure in cd

The CD object should have a data member that is a linked list of your song structure that you have in CD.  The CD class needs a function that allows it to add a song to the object, that function would then append the song to that instance of the link..

  Create an employee class

Create an employee class, including two data: an employee number (type int ) and the employee's compensation (in dollars; type float). The member data should comprise an int for storing the employee number and a float for storing the employee's co..

  Describe the process replace a do...while loop with an equiv

Describe the process you would use to replace a do...while loop with an equivalent while loop. What problem occurs when you try to replace a while loop with an equivalent do...while loop? Suppose you have been told that you must remove a while loop a..

  Operating system and cpu scheduling

Operating System and CPU Scheduling

  The process function will then need

The process function will then need to find the time the person waited by calling the time function and finding the difference between the start and end timestamps. Save this time to an accumulator so that in the end you can find the average wait tim..

  Show the deatils of an emplyoee - c programming

Show the deatils of an emplyoee in a neat format.

  Use a define statement to create a constant

Follow these specifications: Use a define statement to create a constant that will hold your student number. You should have separate string variables for your first and last name; name these first_name and last_name.

  Write song playlist class-object-oriented design principles

Write a song playlist class in C++ called "PlayList" using object-oriented design principles. The playlist should support the following ADT.The implementation should be based on an array of strings to store the song titles.

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