C++ Vector: Computing average and maximum of real numbers
Not what you're looking for?
Write a program that declares a vector of real numbers and input values until a 0 is entered. Add the values to the vector by using push_back(), and compute both the average and the maximum value of the numbers. Output the average and the maximum.
Use the upcoming statements that intialize max to have the value -infinity. The first real number entered will become the new maximum.
double zero = 0.0;
//start max at -infinity
double max = -1.0/zero;
Purchase this Solution
Solution Summary
The solution provides an implementation, tested using g++ compiler, and also hints about another implementation for the given requirement.
Solution Preview
Given requirement can be programmed in many different ways. Please find ...
Purchase this Solution
Free BrainMass Quizzes
Javscript Basics
Quiz on basics of javascript programming language.
Word 2010: Table of Contents
Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.
Inserting and deleting in a linked list
This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.
C++ Operators
This quiz tests a student's knowledge about C++ operators.
Java loops
This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.