SlideShare a Scribd company logo
4.15 LAB: Varied amount of input data
Statistics are often calculated with varying amounts of input data. Write a program that takes any
number of non-negative integers as input, and outputs the max and average. A negative integer
ends the input and is not included in the statistics. Assume the input contains at least one non-
negative integer.
Output each floating-point value with two digits after the decimal point, which can be achieved
by executing cout << fixed << setprecision(2); once before all other cout statements.
Ex: When the input is:
the output is:
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
/* Type your code here. */
return 0;
}

More Related Content

More from atozsha

Take a moment to think about what the word 'integrity' means to you- a.pdf
Take a moment to think about what the word 'integrity' means to you- a.pdfTake a moment to think about what the word 'integrity' means to you- a.pdf
Take a moment to think about what the word 'integrity' means to you- a.pdf
atozsha
 
T or F 51) Forests- woodlands- pastures- and rangelands together occup.pdf
T or F 51) Forests- woodlands- pastures- and rangelands together occup.pdfT or F 51) Forests- woodlands- pastures- and rangelands together occup.pdf
T or F 51) Forests- woodlands- pastures- and rangelands together occup.pdf
atozsha
 
Table4- Measure tnt of size (diameter for cocci- lenath for bacilli) a.pdf
Table4- Measure tnt of size (diameter for cocci- lenath for bacilli) a.pdfTable4- Measure tnt of size (diameter for cocci- lenath for bacilli) a.pdf
Table4- Measure tnt of size (diameter for cocci- lenath for bacilli) a.pdf
atozsha
 
Suppose there is a lion in the bushes- Arrange the pattem of the pathw.pdf
Suppose there is a lion in the bushes- Arrange the pattem of the pathw.pdfSuppose there is a lion in the bushes- Arrange the pattem of the pathw.pdf
Suppose there is a lion in the bushes- Arrange the pattem of the pathw.pdf
atozsha
 
4- Govan and Milica were studying for their physiology final exam- The.pdf
4- Govan and Milica were studying for their physiology final exam- The.pdf4- Govan and Milica were studying for their physiology final exam- The.pdf
4- Govan and Milica were studying for their physiology final exam- The.pdf
atozsha
 
4- From the perspective of the causes of extinction- a reduction in th.pdf
4- From the perspective of the causes of extinction- a reduction in th.pdf4- From the perspective of the causes of extinction- a reduction in th.pdf
4- From the perspective of the causes of extinction- a reduction in th.pdf
atozsha
 
4- Conclude with an analysis of the results of the Project- 4a- What b.pdf
4- Conclude with an analysis of the results of the Project- 4a- What b.pdf4- Conclude with an analysis of the results of the Project- 4a- What b.pdf
4- Conclude with an analysis of the results of the Project- 4a- What b.pdf
atozsha
 
4- Newspaper vending machines are designed so that once you have paid.pdf
4- Newspaper vending machines are designed so that once you have paid.pdf4- Newspaper vending machines are designed so that once you have paid.pdf
4- Newspaper vending machines are designed so that once you have paid.pdf
atozsha
 
4- Choose ONE of the following three research methods- Thoroughly expl.pdf
4- Choose ONE of the following three research methods- Thoroughly expl.pdf4- Choose ONE of the following three research methods- Thoroughly expl.pdf
4- Choose ONE of the following three research methods- Thoroughly expl.pdf
atozsha
 
4- Depending on whether or not organisms use O2 as an oxidant- they ar.pdf
4- Depending on whether or not organisms use O2 as an oxidant- they ar.pdf4- Depending on whether or not organisms use O2 as an oxidant- they ar.pdf
4- Depending on whether or not organisms use O2 as an oxidant- they ar.pdf
atozsha
 
5- Consider the bases and the backbone- Which part is more hydrophobic.pdf
5- Consider the bases and the backbone- Which part is more hydrophobic.pdf5- Consider the bases and the backbone- Which part is more hydrophobic.pdf
5- Consider the bases and the backbone- Which part is more hydrophobic.pdf
atozsha
 
4- Let X and Y be two discrete random variables with joint density fun.pdf
4- Let X and Y be two discrete random variables with joint density fun.pdf4- Let X and Y be two discrete random variables with joint density fun.pdf
4- Let X and Y be two discrete random variables with joint density fun.pdf
atozsha
 
5- a- In which year did Mealy describe his machine- b- In which year d.pdf
5- a- In which year did Mealy describe his machine- b- In which year d.pdf5- a- In which year did Mealy describe his machine- b- In which year d.pdf
5- a- In which year did Mealy describe his machine- b- In which year d.pdf
atozsha
 
5- (6 pts) When chlorophyll absorbs a photon- an electron is excited i.pdf
5- (6 pts) When chlorophyll absorbs a photon- an electron is excited i.pdf5- (6 pts) When chlorophyll absorbs a photon- an electron is excited i.pdf
5- (6 pts) When chlorophyll absorbs a photon- an electron is excited i.pdf
atozsha
 
4- A sociologist studying freshmen at a major university carried out a.pdf
4- A sociologist studying freshmen at a major university carried out a.pdf4- A sociologist studying freshmen at a major university carried out a.pdf
4- A sociologist studying freshmen at a major university carried out a.pdf
atozsha
 
5- (9 Points) Let A- B- C- D be arbitrary sets and subset of Universal.pdf
5- (9 Points) Let A- B- C- D be arbitrary sets and subset of Universal.pdf5- (9 Points) Let A- B- C- D be arbitrary sets and subset of Universal.pdf
5- (9 Points) Let A- B- C- D be arbitrary sets and subset of Universal.pdf
atozsha
 
4- In my sock drawer- I have 10 white socks- 4 black socks- and 2 red.pdf
4- In my sock drawer- I have 10 white socks- 4 black socks- and 2 red.pdf4- In my sock drawer- I have 10 white socks- 4 black socks- and 2 red.pdf
4- In my sock drawer- I have 10 white socks- 4 black socks- and 2 red.pdf
atozsha
 
4- In Drosophila- the mutation for ebony body color is recessive and a.pdf
4- In Drosophila- the mutation for ebony body color is recessive and a.pdf4- In Drosophila- the mutation for ebony body color is recessive and a.pdf
4- In Drosophila- the mutation for ebony body color is recessive and a.pdf
atozsha
 
5) Transform PB - strike s lip penults- 2- DESCRIBE one event or physi.pdf
5) Transform PB - strike s lip penults- 2- DESCRIBE one event or physi.pdf5) Transform PB - strike s lip penults- 2- DESCRIBE one event or physi.pdf
5) Transform PB - strike s lip penults- 2- DESCRIBE one event or physi.pdf
atozsha
 
5) Transfer RNAs (tRNAs) are single-stranded nucleic acids that have f.pdf
5) Transfer RNAs (tRNAs) are single-stranded nucleic acids that have f.pdf5) Transfer RNAs (tRNAs) are single-stranded nucleic acids that have f.pdf
5) Transfer RNAs (tRNAs) are single-stranded nucleic acids that have f.pdf
atozsha
 

More from atozsha (20)

Take a moment to think about what the word 'integrity' means to you- a.pdf
Take a moment to think about what the word 'integrity' means to you- a.pdfTake a moment to think about what the word 'integrity' means to you- a.pdf
Take a moment to think about what the word 'integrity' means to you- a.pdf
 
T or F 51) Forests- woodlands- pastures- and rangelands together occup.pdf
T or F 51) Forests- woodlands- pastures- and rangelands together occup.pdfT or F 51) Forests- woodlands- pastures- and rangelands together occup.pdf
T or F 51) Forests- woodlands- pastures- and rangelands together occup.pdf
 
Table4- Measure tnt of size (diameter for cocci- lenath for bacilli) a.pdf
Table4- Measure tnt of size (diameter for cocci- lenath for bacilli) a.pdfTable4- Measure tnt of size (diameter for cocci- lenath for bacilli) a.pdf
Table4- Measure tnt of size (diameter for cocci- lenath for bacilli) a.pdf
 
Suppose there is a lion in the bushes- Arrange the pattem of the pathw.pdf
Suppose there is a lion in the bushes- Arrange the pattem of the pathw.pdfSuppose there is a lion in the bushes- Arrange the pattem of the pathw.pdf
Suppose there is a lion in the bushes- Arrange the pattem of the pathw.pdf
 
4- Govan and Milica were studying for their physiology final exam- The.pdf
4- Govan and Milica were studying for their physiology final exam- The.pdf4- Govan and Milica were studying for their physiology final exam- The.pdf
4- Govan and Milica were studying for their physiology final exam- The.pdf
 
4- From the perspective of the causes of extinction- a reduction in th.pdf
4- From the perspective of the causes of extinction- a reduction in th.pdf4- From the perspective of the causes of extinction- a reduction in th.pdf
4- From the perspective of the causes of extinction- a reduction in th.pdf
 
4- Conclude with an analysis of the results of the Project- 4a- What b.pdf
4- Conclude with an analysis of the results of the Project- 4a- What b.pdf4- Conclude with an analysis of the results of the Project- 4a- What b.pdf
4- Conclude with an analysis of the results of the Project- 4a- What b.pdf
 
4- Newspaper vending machines are designed so that once you have paid.pdf
4- Newspaper vending machines are designed so that once you have paid.pdf4- Newspaper vending machines are designed so that once you have paid.pdf
4- Newspaper vending machines are designed so that once you have paid.pdf
 
4- Choose ONE of the following three research methods- Thoroughly expl.pdf
4- Choose ONE of the following three research methods- Thoroughly expl.pdf4- Choose ONE of the following three research methods- Thoroughly expl.pdf
4- Choose ONE of the following three research methods- Thoroughly expl.pdf
 
4- Depending on whether or not organisms use O2 as an oxidant- they ar.pdf
4- Depending on whether or not organisms use O2 as an oxidant- they ar.pdf4- Depending on whether or not organisms use O2 as an oxidant- they ar.pdf
4- Depending on whether or not organisms use O2 as an oxidant- they ar.pdf
 
5- Consider the bases and the backbone- Which part is more hydrophobic.pdf
5- Consider the bases and the backbone- Which part is more hydrophobic.pdf5- Consider the bases and the backbone- Which part is more hydrophobic.pdf
5- Consider the bases and the backbone- Which part is more hydrophobic.pdf
 
4- Let X and Y be two discrete random variables with joint density fun.pdf
4- Let X and Y be two discrete random variables with joint density fun.pdf4- Let X and Y be two discrete random variables with joint density fun.pdf
4- Let X and Y be two discrete random variables with joint density fun.pdf
 
5- a- In which year did Mealy describe his machine- b- In which year d.pdf
5- a- In which year did Mealy describe his machine- b- In which year d.pdf5- a- In which year did Mealy describe his machine- b- In which year d.pdf
5- a- In which year did Mealy describe his machine- b- In which year d.pdf
 
5- (6 pts) When chlorophyll absorbs a photon- an electron is excited i.pdf
5- (6 pts) When chlorophyll absorbs a photon- an electron is excited i.pdf5- (6 pts) When chlorophyll absorbs a photon- an electron is excited i.pdf
5- (6 pts) When chlorophyll absorbs a photon- an electron is excited i.pdf
 
4- A sociologist studying freshmen at a major university carried out a.pdf
4- A sociologist studying freshmen at a major university carried out a.pdf4- A sociologist studying freshmen at a major university carried out a.pdf
4- A sociologist studying freshmen at a major university carried out a.pdf
 
5- (9 Points) Let A- B- C- D be arbitrary sets and subset of Universal.pdf
5- (9 Points) Let A- B- C- D be arbitrary sets and subset of Universal.pdf5- (9 Points) Let A- B- C- D be arbitrary sets and subset of Universal.pdf
5- (9 Points) Let A- B- C- D be arbitrary sets and subset of Universal.pdf
 
4- In my sock drawer- I have 10 white socks- 4 black socks- and 2 red.pdf
4- In my sock drawer- I have 10 white socks- 4 black socks- and 2 red.pdf4- In my sock drawer- I have 10 white socks- 4 black socks- and 2 red.pdf
4- In my sock drawer- I have 10 white socks- 4 black socks- and 2 red.pdf
 
4- In Drosophila- the mutation for ebony body color is recessive and a.pdf
4- In Drosophila- the mutation for ebony body color is recessive and a.pdf4- In Drosophila- the mutation for ebony body color is recessive and a.pdf
4- In Drosophila- the mutation for ebony body color is recessive and a.pdf
 
5) Transform PB - strike s lip penults- 2- DESCRIBE one event or physi.pdf
5) Transform PB - strike s lip penults- 2- DESCRIBE one event or physi.pdf5) Transform PB - strike s lip penults- 2- DESCRIBE one event or physi.pdf
5) Transform PB - strike s lip penults- 2- DESCRIBE one event or physi.pdf
 
5) Transfer RNAs (tRNAs) are single-stranded nucleic acids that have f.pdf
5) Transfer RNAs (tRNAs) are single-stranded nucleic acids that have f.pdf5) Transfer RNAs (tRNAs) are single-stranded nucleic acids that have f.pdf
5) Transfer RNAs (tRNAs) are single-stranded nucleic acids that have f.pdf
 

Recently uploaded

Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
plant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsplant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated crops
parmarsneha2
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
Nguyen Thanh Tu Collection
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 

Recently uploaded (20)

Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
plant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsplant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated crops
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 

4-15 LAB- Varied amount of input data Statistics are often calculated (1).pdf

  • 1. 4.15 LAB: Varied amount of input data Statistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative integers as input, and outputs the max and average. A negative integer ends the input and is not included in the statistics. Assume the input contains at least one non- negative integer. Output each floating-point value with two digits after the decimal point, which can be achieved by executing cout << fixed << setprecision(2); once before all other cout statements. Ex: When the input is: the output is: #include <iostream> #include <iomanip> using namespace std; int main() { /* Type your code here. */ return 0; }