# C ++ quiz | Computer Science homework help

C ++ Quiz.

Don't use plagiarized sources. Get Your Custom Essay on
Need an answer from similar question? You have just landed to the most confidential, trustful essay writing service to order the paper from.
Just from \$11/Page

You should use simple control structures (such as sequence, selection, iteration, do or while, e.t.c) and functions.

1A) Write a program that will loop continuously to get user input of positive numbers and total them out. The loop will only stop when the user enters non-positive numbers (including zero). The program will display the average before it ends.

B) Write a program that will randomly generate a number from 1 to 100. The user will then guess the number via several attempts. Each time the guess is wrong, the program will let the user know if it is higher or lower than the number. If the number guessed is correct, it will print “Bingo!” and quit the program.

C) Write a program that asks user to type of series of positive integers. When the user types a negative value, the program should display error message and ask for another value. If the user types 0, it means that the series has end and the program should display the average of all the positive values provided. If the number of typed values is zero, the program writes “No Average”.

D) Write a program to request the user to input a numeric value. If the input is even, the program will display all the even numbers from 2 until the input. If the number is odd, the program will display all the odd numbers from 1 until the input.

E) A laundry shop charges its customer RM5, for every kilo of laundry. Write a program that asks for the laundry weight and if ironing is wanted. For every kilo, RM7 is charged for iron. Display the total price including ironing cost.

F) Write a function named shift that receives an array of 10 integers, one integer at the index location, shifting each array item to the right and eliminate the last item. The function must then display the final array content.

2) Write a program using struct that calculates the sales of items in a store. The program must have a function that works with struct.