Write a cpp program for magic number

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

Instructions

Ask the user to enter a "magic number," which is an integer between 0 and 9, inclusive.

Then, ask a user to enter 10 integers between 0 and 9, inclusive. (If a user enters an integer outside of that range, therefore invalid, notify the user of the error and ask for him/her to try again. Invalid numbers do not count towards the 10 valid integers requirement.)

NOTE: User input should be done in a repetition structure (loop). Ten sequential input statements will not satisfy the requirements of this assignment.

Your program should output the following:

How many times the user entered the magic number.

The average of all the valid numbers that the user entered.

Sample Output:

What is the "magic number?" 4

Enter a number from 0 to 9: 4

Enter a number from 0 to 9: 1

Enter a number from 0 to 9: 4

Enter a number from 0 to 9: 3

Enter a number from 0 to 9: 7

Enter a number from 0 to 9: 1

Enter a number from 0 to 9: 5

Enter a number from 0 to

Reference no: EM13763088

Questions Cloud

Algorithm attributes and their importance. : Write a 2 page research paper (excluding title and reference pages) on algorithm attributes and their importance. Use two resources (Wikipedia sources are not permitted) and list each resource used at the end of the paper in the reference list sec..
Function that returns a token when it is needed. : A major component of your assignment will be to write a procedure (Function) that returns a token when it is needed. Your lexer should return a record, one field for the token and another field the actual "value" of the token (lexeme), i.e. the in..
What were you most surprised to learn from the film : What were you most surprised to learn from the film? Why did the American government decide to assimilate Native American children into Western culture?
Ratio computations and effect of transactions : Presented below is information related to Carver Inc.
Write a cpp program for magic number : Ask the user to enter a "magic number," which is an integer between 0 and 9, inclusive. Then, ask a user to enter 10 integers between 0 and 9, inclusive. If a user enters an integer outside of that range, therefore invalid, notify the user of the ..
Write down the first order necessary conditions : Write down the Lagrangean for problem and Write down the first order necessary conditions (FOC) for a minimum.
What you have learned about children who are gifted : What you have learned about children who are gifted and talented. What are the special needs of young children who are gifted and talented? What are the special needs of older children?
Problems related to astronomy : What is the approximate wavelength of this signal?
Modify the inventory program to include an add button : Modify the Inventory Program to include an add button, a delete button, and a modify button on the GUI. These buttons should allow the user to perform the corresponding actions on the item name, the number of units in stock, and the price of each ..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Wave steepness is the ratio of wave height

Wave steepness is the ratio of wave height (WH) to wave length(WL) and is an indicator of wave stability. When wave steepness exceeds a 1/7 ratio; the wave becomes unstable and begins to break. Assume a data file exits with the following header

  1 implement the tronomino tiling algorithm your program

1. implement the tronomino tiling algorithm. your program should take an arbitrary input positive integer k in the

  Write a program that request a students name

Write a program that request a student's name in the subsequent form: lastName,firstName.

  What is a cell reference

What is a cell reference (also called a cell address) and what is the significance of being able to use them in spreadsheet formulas?

  Classes and objects are the basic concepts of

question 1. list three debugging techniques within the debugger that can be used to locate logical error in the java

  The program calls a function called getgrades

The program calls a function called GetGrades that will read in grades from the keyboard, the number of grades should also be input by the user.

  Write the complete description of all functions

Use the following class declarations. Write the complete description of all functions so that the program creates the following I/O

  The owner of a hardware store and need to keep an inventory

You are the owner of a hardware store and need to keep an inventory that can tell you what tools you have, how many you have and the cost of each one. Write a C program to create a file named storage.dat and write the data shown in the Table 1 into t..

  Write the code and output screendesign a base class shape

write the code and output screendesign a base class shape with virtual functionsvoid drawgrapicwindowamp win constvoid

  C++ programming to add-subtract-multiply or divide two no

create a text-based, menu-driven program that allows the user to choose whether to add, subtract, multiply or divide two numbers. The program should then input two double values from the use, perform the appropriate calculation, and display the re..

  Write a program that requires the number of bits

Write a program that requires the number of bits for the exponent and significant of a floating point representation, then requires two decimal real numbers and an operation, sum, subtraction or multiplication.

  Write a c++ program that reads a set of integers

Write a c++ program that reads a set of integers and then finds and prints the sums of the even and odd numbers.

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