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 the output of the program

Design a C++ program that will interactively prompt for and read the name of the input file interactively prompt for and read the name of a file to write the output of the program to write the following to the specified output file your name, sect..

  How nested if-statements replace with one if-statement

Describe how following nested If-statements could be replaced with one if-statement using logical operator (And/Or/Not). Write down the C++ code example.

  Implement a simplified version of the set class

You will implement a simplified version of the set class. You must implement all functions defined in the provided file set.h. You may add other member functions and variables as necessary.

  If a class is derived protected

If a class is derived protected from a base class, explain how this affects the inheritance of all public, protected, and private members of the base class by the derived class.

  Program to check compatibity for matrix multiplication

Write down program in C++ for matrix multiplication. Program must accept dimension of both matrices to be multiplied and check for compatibity.

  Create a text adventure game that uses pointers

Create a text adventure game that uses pointers. You have a rich, eccentric Uncle Billy who is soon to be deceased.

  Write a program that plays a tic-tac-toe game.

Using functional decomposition, write a program that plays a tic-tac-toe game.

  Main function to input twenty integers in given range

Write a main function to input 20 integers in range of 1-6, function should count number of times the numbers 2 and 5 occur. function must declare statics variables count2 and count5.

  Prepare a linear support vector machine svm

Write a computer program to prepare a Linear Support Vector Machine SVM

  Prepare an accounting for a dorm''s kitchen

The "purpose" of the program is to prepare an accounting (database) for e.g. a dorm's kitchen, to keep track of the consumption of beer for each room.

  Write a program that converts between app and ppm values

Write a simple program that converts between APP and PPM values

  Lu decomposition with gauss elimination

The LU decomposition with Gauss elimination and what is the physical interpretation of the elements of ? Write C++ programs for steps 2, 3, and 4.

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