

Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Prepara tus exámenes
Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Prepara tus exámenes con los documentos que comparten otros estudiantes como tú en Docsity
Encuentra los documentos específicos para los exámenes de tu universidad
Estudia con lecciones y exámenes resueltos basados en los programas académicos de las mejores universidades
Responde a preguntas de exámenes reales y pon a prueba tu preparación
Consigue puntos base para descargar
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Comunidad
Pide ayuda a la comunidad y resuelve tus dudas de estudio
Ebooks gratuitos
Descarga nuestras guías gratuitas sobre técnicas de estudio, métodos para controlar la ansiedad y consejos para la tesis preparadas por los tutores de Docsity
laboratorio programacion codigo c++
Tipo: Apuntes
1 / 2
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!


This challenge is about using a collection (list) of integers and allowing the user to select options from a menu to perform operations on the list. Your program should display a menu options to the user as follows: P - Print numbers A - Add a number M - Display mean of the numbers S - Display the smallest number L - Display the largest number Q - Quit Enter your choice: The program should only accept valid choices from the user, both upper and lowercase selections should be allowed. If an illegal choice is made, you should display, "Unknown selection, please try again" and the menu options should be displayed again. If the user enters 'P' or 'p', you should display all of the elements (ints) in the list. If the list is empty you should display "[] - the list is empty" If the list is not empty then all the list element should be displayed inside square brackets separated by a space. For example, [ 1 2 3 4 5 ] If the user enters 'A' or 'a' then you should prompt the user for an integer to add to the list which you will add to the list and then display it was added. For example, if the user enters 5 You should display, "5 added". Duplicate list entries are OK If the user enters 'M' or 'm' you should calculate the mean or average of the elements in the list and display it. If the list is empty you should display, "Unable to calculate the mean - no data"
If the user enters 'S' or 's' you should display the smallest element in the list. For example, if the list contains [2 4 5 1], you should display, "The smallest number is 1" If the list is empty you should display, "Unable to determine the smallest number - list is empty" If the user enters 'L' or 'l' you should display the largest element in the list For example, if the list contains [2 4 5 1], you should display, "The largest number is 5" If the list is empty you should display, "Unable to determine the largest number - list is empty" If the user enters 'Q' or 'q' then you should display 'Goodbye" and the program should terminate. Before you begin. Write out the steps you need to take and decide in what order they should be done. Think about what loops you should use as well as what you will use for your selection logic. This exercise can be challenging! It may likely take a few attempts before you complete it -- that's OK! Finally, be sure to test your program as you go and at the end. Hint: Use a vector! Additional functionality if you wish to extend this program.