A series of one-digit non-negative numbers

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

Write a program that asks the user to enter a series of one-digit non-negative numbers

When the user has finished entering numbers (Note: the user should indicate that they are finished by
entering the value 10), print out how many of each number the user entered.
There must be three functions including main.
The main function will read in the values from the user and do validity checking on the input. If the
number is in the range 0 to 9 main will call a second function that will count the number.
After all of the numbers have been entered the main function will call a third function to display the
results.
You must not use global variables.
Name your program Lab10_Exercise2.cpp.
Hint: Use an array to hold all ten counters. There will be one element in the array for keeping track of
the inputted values of 0 through 9.
Note: Do not output a value of a digit if no digits with that value were entered by application user. Note
that in the below output the "You entered" text is only displayed for 0, 2 and 7 since those were the
only numbers entered by the application user.

Here is a sample output if the user entered -1, 0, 11, 7, 7, 2, 7, and 10:

Enter a one-digit number or 10 to exit: -1[Enter]
The value -1 is not valid.
Enter a one-digit number or 10 to exit: 0[Enter]
Enter a one-digit number or 10 to exit: 11[Enter]
The value 11 is not valid.

Enter a one-digit number or 10 to exit: 7[Enter]
Enter a one-digit number or 10 to exit: 7[Enter]
Enter a one-digit number or 10 to exit: 2[Enter]
Enter a one-digit number or 10 to exit: 7[Enter]
Enter a one-digit number or 10 to exit: 10[Enter]

You entered 1, 0(s)
You entered 1, 2(s)
You entered 3, 7(s)

 

 

Reference no: EM13158812

Questions Cloud

Economic benefit doctrine : Explain the economic benefit doctrine. Describe the components of the common body of tax law (CBOTL). What role does the U.S. Congress play in creating the tax law? Briefly explain how a tax bill becomes a tax law.
Why would the carbon dioxide concentration to be higher : You have two flasks with borth media. One contains a species of cyanobacteria. The other flask contains E. coli. Both flasks are sealed and incuabated under optimal growth conditions for two days.
What constructors do and when they are executed : Explain what constructors do and when they are executed. Explain the two types of constructors. Provide an example class that includes both types of constructor functions and demonstrate how an object would be instantiated using both types of constru..
Interpretation of picket-fence federalism : Give your own interpretation of picket-fence federalism. List and explain at least three strategies states used to respond to welfare reform following the implementation of the Personal Responsibility and Work Opportunity Act of 1996.
A series of one-digit non-negative numbers : Write a program that asks the user to enter a series of one-digit non-negative numbers
Interest quarterly until the note is repaid : Johnson's borrowed $150,000 at a 12 percent annual interest rate on April 1, 2010, to expand its boat storage facility. The loan requires Johnson's to pay the interest quarterly until the note is repaid in three years. Johnson's paid quarterly int..
Theoretical approaches to metaphysics dualism : Four theoretical approaches to metaphysics dualism, materialism, idealism and alternative views are competing for the right that they are the correct metaphysical view.
Read in information systems : Discuss communication in Unix vs other communication tools we use outside of the operating system (example:text, IM). Discuss anything you have read in Information Systems this past week or tell me what is on your mind about Information Systems.
Report as retained earnings problem : What amount should Gunkel report as retained earnings as of March 1, 2011?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write program to perform add-drop-list and update functions

Write C++ program to do add, drop, list (in last name / first name sorted order or id) and update functions. separate UI from data processing use object programming method multiple files

  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..

  C assignment of curl library

C Assignment Curl library must be used To be done on linux, it should be compiled using the following command: gcc -Wall -ansi -pedantic NameOfFile.c -lncurses Please make sure it is commented with clarification Variable names in camel case

  Write function to accept character array

Write down the C++ function which will accept the character array of at most 30 cells. Your function must return true if string and its reverse are identical;

  Write a program that inputs a dollar amount to be printed

Write a program that inputs a dollar amount to be printed on a check and then prints the amount in check-protected format with leading asterisks if necessary

  Design for storing the maze layout

Design and implement a C++ program for maze layout

  Write a bouncing ball video game

The balls bounces within the screen where the two horizontal walls are fixed

  Write program to count occurrences of each word in text

Write down C++ program to read following text. Count occurrences of each word in text and keep this count in list of elements containing (word, occurrence count) pairs.

  Calculate the trajectory of a soccer ball

Write a program to calculate the trajectory (flight path) of a soccer ball

  Write the code

Write a program that allows an instructor to keep a grade book. Each students has scores for exams, homework assignments, and quizzes.

  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 a program to calculate existing angles

Write a program to calculate existing angles and do if and then from this, and to place fixed angles at certain position.

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