Determine the larger and smaller integers

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

Write a C++ program that will use loops to perform each of the following tasks:

1. Ask the user for two characters from the keyboard and read them into char variables.

Determine which input is larger and which is smaller.

Write out all of the characters between smaller and larger including both end points (the input characters) in small to large order.

Example: input of (d k), output of (d e f g h i j k)
Example: input of (R M), output of (M N O P Q R)

2. Ask the user for two integer values and read them into int variables.

Determine the larger and smaller integers.

Write out every second integer, starting with the larger one and stopping at the lower one. (note: if one number is even and one is odd, the lower value will not show up in the output).

Example: input of (13 5), output of (13 11 9 7 5)
Example: input of (13 6), output of (13 11 9 7)

3. Ask the user for an integer in the range of 1 to 10, and read the value into an int variable.

Use a loop to check if the user's input was in the correct range.

If the input value was not in the 1-10 range, write out an error message, prompt the user for a new value, and read in this new value. Repeat this process until a value in the correct range is found.

Use another loop to calculate the factorial of the input value. (factorial can be found by multiplying together all of the integers from 1 up to your number, so 4! can be calculated as 1*2*3*4 in a simple counting loop)

Output the input value and the calculated factorial value with a text message  (i.e. "4! is 24")

4. Ask the user if they would like to repeat the program (all of the preceding steps (steps 1-3) and read in their response.

If the user chooses to repeat, then repeat steps 1-4
If the user chooses not to repeat, write out a goodbye message and let the program end.

Reference no: EM131207861

Questions Cloud

How did case become customer driven : In 1995 Case became Case IH, consolidating International Harvester with Case. Tenneco's decreased ownership in Case resulted in Case becoming 79% publicly owned.
Deepest recessions in history-the great depression : If we compare the two deepest recessions in history-the Great Depression and the recession of 2009-they both had a huge impact on the economy, but both of them were handled very differently by governments. The policies governing trade after the 20..
Compute the 2013 tax liability for charlotte : Charlotte is a surviving spouse and provides all of the support of her four minor children who live with her.- Using the Tax Rate Schedules, compute the 2013 tax liability for Charlotte.
What key competitive dimensions are driving sales : Consider the two categories of products that Timhuk2 makes and sells. For the custom messenger bag, what key competitive dimensions are driving sales? Are the company's competitive priorities different for the new laptop bags sourced in China?
Determine the larger and smaller integers : Determine the larger and smaller integers. Write out every second integer, starting with the larger one and stopping at the lower one. (note: if one number is even and one is odd, the lower value will not show up in the output).
Servant leadership models and other models : What are the most significant differences between servant leadership models and other models? Define the paradox of servant leadership and explain where you see this paradox present in your own representation.
What is the breakeven point for jane corporation : Jane Corporation produces model toy cars. Each sells for $29.99. Its variable cost per unit is $14.25. Assuming it has a fixed cost of $314,800. What is the breakeven point for Jane Corporation?
Develop at least five major goals for the it strategic plan : Develop at least five major goals for the information technology strategic plan. Speculate on three positive organizational impacts of implementing the strategic plan. Justify your response.
Life cycle theory to foreign direct investment : Explain fully the advantages of expanding across borders??1 2. Distinguish in detail the reasons and advantages of expanding into different nations through mergers and acquisitions, as opposed to greenfield investments.??13. Discuss in detail the ..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  How will you declare a float string char bool and decimal

How will you declare a float, string, char, bool, and decimal? Assign values to these data types as 1278.977, C#, c, and true

  Write a for loop that displays the following set of numbers

Write a for loop that displays the following set of numbers 0, 5, 10, 15, 20, 25 ...... 500.

  Prepare a program for sorting the numbers

Write a program that orders three double numbers by increasing value. The program should include a function named sort3 that takes three double * arguments (pointer to double). The function prototype is void sort3(double *x, double *y, double *z);

  Calculates an employees wage for a week

Write a program that calculates an employee's wage for a week. An employee's wage is calculated as follows - if the number of hours is less than or equal to 40, then the total payment is hour rate

  Secure computing environment

Web services sounds way too complex to be viable...how are little chunks of code from many organizations really going to work together and provide a reliable and secure computing environment?

  Find the smallest positive integer

Find the smallest positive integer whose digits add up to 23. The second smallest positive integer whose digits add up to 23 is 689.

  Odd clusters using c programming

The objective of this project is to write an interactive Odd Clusters game, using the programming knowledge you have gained this semester. Your task is to write a programthat allows one player to play a game of Odd Clusters against the computer o..

  Attribute information about an array of floating point

Write a program that contains a main function and three other functions that will return various attribute information about an array of floating point

  Write a program in c using function, float pos_power

Write a program in C language. Write a function, float pos_power(float base, int exponent); which returns the value of base raised to a positive exponent. For example, if base is 2.0 and exponent is 3, the function should return 8.0. If the expone..

  Define the term root-to-leaf path in detail

My goal, given a binary tree and a sum, is to return true if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. Returning false if no such path can be found.

  Discuss why naming conventions are important

Why is it important to consistently follow coding rules and techniques? What are the pitfalls of not doing so?

  Compare run times using an array

Write a iterative and recursive versions of binary search and compare their run times using the array a[i]=i, i=0,...,n-1 and the subsequent test method:

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