Programming in C
Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
bartleby

Concept explainers

Question
Book Icon
Chapter 6, Problem 3E
Program Plan Intro

Program Plan:

  • Include required header files.
  • Declare the function “main ()”.
    • Declare required variables “ratingCounters [11]”, “i”, “j”, “response”.
    • Loop from 1 through 10.
      • Assign “0” to the array index.
    • Do until the “while” condition “response!=999” fails.
      • Get the response from the user.
      • Check the condition “response < 1 || response > 10”.
        • Print the error message.
      • Else, increment the counter.
      • Increment the variable “i”.
    • Loop from 1 through 10
      • Print the number of responses.
    • Return the statement.

Blurred answer
Students have asked these similar questions
Use C++ Write a program that reads a list of integers, and outputs whether the list contains all even numbers, odd numbers, or neither. The input begins with an integer indicating the number of integers that follow. Ex: If the input is: 5 2 4 6 8 10 the output is: all even Ex: If the input is: 5 1 -3 5 -7 9 the output is: all odd Ex: If the input is: 5 1 2 3 4 5 the output is: not even or odd Your program must define and call the following two functions. IsVectorEven returns true if all integers in the array are even and false otherwise. IsVectorOdd returns true if all integers in the array are odd and false otherwise.bool IsVectorEven(vector<int> myVec)bool IsVectorOdd(vector<int> myVec)
Loops, C++ Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 5 as long as the value is less than or equal to the second integer. Ex: If the input is: -15 10 the output is: -15 -10 -5 0 5 10 Ex: If the second integer is less than the first as in: 20 5 the output is: Second integer can't be less than the first. For coding simplicity, output a space after every integer, including the last.
Use C++ Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, and output all integers less than or equal to that value. Ex: If the input is: 5 50 60 140 200 75 100 the output is: 50 60 75 The 5 indicates that there are five integers in the list, namely 50, 60, 140, 200, and 75. The 100 indicates that the program should output all integers less than or equal to 100, so the program outputs 50, 60, and 75. For coding simplicity, follow every output value by a space, including the last one. Such functionality is common on sites like Amazon, where a user can filter results. Write your code to define and use two functions:vector<int> GetUserValues(vector<int>& userValues, int numValues)void OutputIntsLessThanOrEqualToThreshold(vector<int> userValues, int upperThreshold) Utilizing functions helps to make main() very clean and intuitive.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning