Write a cpp program that will present the user with a menu

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

Computer Science

Program-

Write a C++ program that will:

Present the user with a menu of choices:

1. Random number
2. String
3. Type Casting
4. Integer Math

Then, in an if-else if structure (or switch) write the code for each option.

Option 1:

Write out a random number in the range of -5 to 5 (including both 5 and -5). The program should be able to write out a different random number each time the program is run.

Option 2:

Prompt the user and read in a string (that contains blank spaces) from the keyboard. Write out the length of the input string along with the first and last characters in the string.

Option 3:

Ask the user for an integer in the range of 33-126, and read this integer in from the keyboard. Treating this integer as an ASCII value, write out the character that the number represents.

Then, ask the user for a character input and read their input into a char variable. Write out the ASCII value that the computer uses to represent this input character.

Option 4:

Ask the user for 2 integers and read them into 2 int variables (i.e.A,B). Using only +=, -=, and *=,
add the two int variables and store the result in the first input variable ( A <- A + B)
subtract the first input variable from the second, storing the result to the second (B <- B - A).
add the two variables and store the result to the first input variable (A <- A + B)
multiply the second variable by -1 and store the result back into the same variable (B <- B * -1).

Write out the new values of the two variables (in original order A,B) Write out text messages with all numeric output to explain what has been done

Required Comments:

Name block (your name, course number, assignment number)

After the name block: A simple description of what the program does. Before each option in the if-else if, briefly say what that section is for.

Reference no: EM131197022

Questions Cloud

Calculate the minimum number of plates : The feed is cold, and for each mole of feed 0.15 mole of vapor is condensed at the feed plate.  The reflux ratio at the top of the column is 1.4, and the reflux is at its bubble point.  Calculate the minimum number of plates
Determining the constant volume process : During an Adiabatic compression in an engine, the volume is reduced to 0.0625 of its initial value. Heat is then added at constant pressure until the initial volume is attained again. The cycle is completed by a constant volume process.
Explain the major theoretical paradigms of sociology : Define the basic concepts used in the discipline of sociology. Explain the major theoretical paradigms of sociology. Use technology and information resources to research issues in sociology.
Relationship between personality and job performance : Explain how OB scholars and leaders should apply this knowledge in organisations - Conduct academic research to decide and explain your answer.
Write a cpp program that will present the user with a menu : Write a C++ program that will Present the user with a menu of choices Random number, String, Type Casting and Integer Math.
Calculate the escape velocity of the moon : a). Write an essay to explain why the polar regions of the Moon are the most favourable sites for the establishment of a lunar base. b). Calculate the escape velocity of the Moon in units of km/s
Address animal welfare and environmental concerns : Question 1: The article calls for public policy initiatives to address animal welfare and environmental concerns associated with dairy farming. With reference to economic concepts covered in this course, explain why the government might want to in..
Compute the mean and variance of this distribution : The lifetime distributions of high-speed recordable optical disks is assumed to follow lognormal distribution (Irine and Okino, IEEE Trans. on Magnetics, 2007). Suppose μ = 2.5 and σ = 0.5 weeks.
Personal injury lawyers may be paid a contingency fee equal : Personal injury lawyers may be paid a contingency fee equal to a percentage of the amount awarded. The lawyer receives payment only if his or her client wins the case and is awarded a sum of money. Lawyers in other types of cases are often paid on an..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  That reads ten numbers from input and prints

Write a C program that reads ten numbers from input and prints them in reverse order. We assume that the data consists of integers. The program should conform to the following format

  Write an iterative function power

Write an iterative function power1 to compute xn for n >= 0 and write a recursive function power2 to compute xn by using the following recursive formulation

  Write a c++ program that would take two 3x3 matrix

Write a C++ program that would take two 3x3 matrix and outputs the results of adding, subtracting and multiplying two matrices. Create at least three functions: one that performs addition,

  Write a c program that display the hexadecimal equivalent

Write a C program that will accept a hexadecimal number as input, and then display a menu that will permit any of the following operations to be carried out: (a) Display the hexadecimal equivalent of the one"s complement.

  Your program will read the array

Your program will read the array from the file, check the diagonal and print a report containing the size and the status of the diagonal. A typical report would look like: The matrix is 3x3 and all the numbers on the main diagonal are the same.

  Write a menu-driven program that maintains an address book

Write a menu-driven program that maintains an address book using a linked list. The address book must supports the following operations

  Create a simple text editor that has one large rich text box

Complete the following programming exercise (SIMPLE TEXT EDITOR WITH ONE LARGE RICH TEXT BOX). You will use the OpenFileDialog, StreamReader and StreamWriter objects; the Close, Peek, ReadLine, ShowDialog and WriteLine methods.

  What are the row and column indexes of chicago in the array

What is the value of the expression cities[2][1]?

  Create a vector of 2d and 3d geometric figures

Write a C++ program that allows the user to create a vector of 2D and 3D geometric figures then computes their areas and volumes if possible

  Write a program using one while loop

Write a program using one while loop that will read in a sequence of integers guaranteed to be within the inclusive range of 0 through 99,999 from the user

  Write a loop that read positive integers from standard input

Any value that is the same as the immediately preceding value is considered a CONSECUTIVE DUPLICATE. In this example, there are three such consecutive duplicates: the 2nd and 3rd 5s and the second 6. Note that the last 3 is not a consecutive dupli..

  Calculate the volume of a slant cylinder

Write a set of functions that calculate the volume of a slant cylinder (actually a prism) with an irregular pentagonal cross section - Write a function named polyvol to solve this.

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