Prompts the user to enter an integer

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

Step 1. Write the code that prompts the user to enter an integer between 1 and 20 (including 1 and 20), reads the value using cin, and then prints the value that they entered in a statement that begins with "You entered a ". Save this version in a separate location so that you can submit it.
Step 2. Add more code or modify your code so that if the user enters a value that is less than 1 or greater than 20, it prints out "The value you entered is not between 1 and 20." Otherwise, and only if the value is between 1 and 20, it prints the statement as before. Save this version in a separate location so that you can submit it.
Step 3. Add more code or modify your code so that if the user enters the values 8, 11, or 18, the statement that is printed is "You entered an" instead of "You entered a". Save this version in a separate location so that you can submit it.
Step 4. Add more code or modify your code so that if the users something that is not a number, i.e. includes letters, your program does not print any of the above lines, but instead prints out "Idiot! Your input could not be read as a number. Get a life!". As mentioned in the previous assignment, you can test to see if the previous cin failed to read a value by calling cin.fail()

Reference no: EM13159255

Questions Cloud

Compute and use standard deviations from the samples : state the hypotheses and identify the claim. compute the test value At a = 0.05, decide if there is enough evidence to reject the claim of no difference in the ages fo the two groups. Compute and use the standard deviations from the samples.
Amount of gain-straight line method : P Company continued to depreciate the equipment over its 9 year remaining life using the straight-line method. This equipment was sold to a third party on January 1, 2011 for $1,440,000. What amount of gain should P Company record on its books in ..
Offset of volcanic formation : Measure the offset of this volcanic formation using the map and distance scale in Figure 3. Then calculate an estimated average annual rate of movement in centimeters per year along the San Andreas Fault
What is the pressure in the container : If 2.61 g of methane gas (CH4) is introduced into an evacuated 1.67 L container at 15°C, what is the pressure in the container?
Prompts the user to enter an integer : Write the code that prompts the user to enter an integer between 1 and 20 (including 1 and 20), reads the value using cin, and then prints the value that they entered in a statement that begins with "You entered a ". Save this version in a separate l..
Does confidence interval interpretation agree with results : Find the 90% confidence interval fo the mean. Does the confidence interval interpretation agree with the hypothesis testing results? Explain.
Determine the heat of combustion of ethylene : The bond energies are: C H 416 kJ/mol; C C 356 kJ/mol; C C 598 kJ/mol; O O 498 kJ/mol; C O 803 kJ/mol; H O 467 kJ/mol.determine the heat of combustion of ethylene ?
What is real or physical and evidence : What is real, or physical, evidence? Describe. ?Provide 3 examples of a piece of real evidence. ?What is the importance of physical or real evidence to the investigation?
Explain what alternatives choose to increase profits : Decrease your sales price by $5 in order to increase sales by 5,000 units. Which of the above alternatives would your choose to increase profits?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program that will be used to gather statistical data

Write a program that will be used to gather statistical data about the number of movies

  Program to calculate word ladders where single-character

Write down a program in C++ to calculate word ladders where single-character substitutions have the cost of 1, and single-character additions or deletions.

  Create a program that maintains the required book catalog

Create a program that maintains the required book catalog for the circulation desk of a library.

  Prepare a program that uses at least two functions

Prepare a program that uses at least two functions that can be called from your main.

  Implement the guess the word

Implement  the ‘Guess the Word' game in an object-oriented manner

  Computer programming using c language lab

Computer programming using c language lab

  Write c program to read one ip address

Write a C or C++ program which Read one IP address at a time from Dec_IPAddresses.txt and convert it into Hex. Store converted values stored in another file (e.g. HEX_IPAddresses.txt).

  Why does the neverwet spray protect it from water

As is know, acetone is a polar molecule like water, so isn't it suppose to mix? So my question is: why does the Neverwet spray protect it from water but not from oils and detergents?

  Design a deck plan space ship in eclipse

Develop a simple interactive two-dimensional spaceship deck plan editor using OpenGL and GLUT. Your program will enable a user to create and save a deck plan of a hypothetical spaceship comprising the hull walls.

  Flipflaps - game based on pancake sorting

The project is to design and write a C++ 11/FLTK game program with a graphical user interface.The game is based on "pancake sorting,", which actually has some mathematical significance.

  Write program that stores the numbers in array

Write a c++ program that stores the following numbers in the array named miles: 15,22,16,18,27,23, and 20. have your program copy the data stored in miles to another array.

  Design and implement a library system

Design and implement a library system that does the following: ? Takes details of a student/library users: first name, last name, other names, user ID number, and nationality.

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