SlideShare a Scribd company logo
Write a C++ program to get input of a data set of 14 double values (grades) from the standard
input device (the keyboard),
then calculate and report the sum and the mean of the data set, then the individual DEVIATION
of each individual
input with respect to the mean, the variance of the dataset, and finally the standard deviation of
the data set.
This problem requires you to integerate multiple things together: arrays, loops, functions.
More specifically, you want to use loops to deal with input, save them to array, or calculate sum
and individual deviation,
and display results etc. in separate functions.
A sample run.
Please let me know how many grades you would like to input?
14
Input them one by one: 89 95 72 83 99 54 86 75 92 73 79 75 82 73.
Enter a grade: 89
Enter a grade: 95
Enter a grade: 72
Enter a grade: 83
Enter a grade: 99
Enter a grade: 54
Enter a grade: 86
Enter a grade: 75
Enter a grade: 92
Enter a grade: 73
Enter a grade: 79
Enter a grade: 75
Enter a grade: 82
Enter a grade: 73
The sum is: a number here.
The mean is: 80.5
GRADE INDIVIDUAL DEVIATION
89 8.5
95 14.5
72 -8.5
83 2.5
99 18.5
54 -26.5
86 5.5
75 -5.5
92 11.5
73 -7.5
79 -1.5
75 -5.5
82 1.5
73 -7.5
The variance is: 124.679
standard deviation: 11.166
Write a C++ program to get input of a data set of 14 double values (grades) from the standard
input device (the keyboard),
then calculate and report the sum and the mean of the data set, then the individual DEVIATION
of each individual
input with respect to the mean, the variance of the dataset, and finally the standard deviation of
the data set.
This problem requires you to integerate multiple things together: arrays, loops, functions.
More specifically, you want to use loops to deal with input, save them to array, or calculate sum
and individual deviation,
and display results etc. in separate functions.
A sample run.
Please let me know how many grades you would like to input?
14
Input them one by one: 89 95 72 83 99 54 86 75 92 73 79 75 82 73.
Enter a grade: 89
Enter a grade: 95
Enter a grade: 72
Enter a grade: 83
Enter a grade: 99
Enter a grade: 54
Enter a grade: 86
Enter a grade: 75
Enter a grade: 92
Enter a grade: 73
Enter a grade: 79
Enter a grade: 75
Enter a grade: 82
Enter a grade: 73
The sum is: a number here.
The mean is: 80.5
GRADE INDIVIDUAL DEVIATION
89 8.5
95 14.5
72 -8.5
83 2.5
99 18.5
54 -26.5
86 5.5
75 -5.5
92 11.5
73 -7.5
79 -1.5
75 -5.5
82 1.5
73 -7.5
The variance is: 124.679
standard deviation: 11.166
Write a C++ program to get input of a data set of 14 double values (grades) from the standard
input device (the keyboard),
then calculate and report the sum and the mean of the data set, then the individual DEVIATION
of each individual
input with respect to the mean, the variance of the dataset, and finally the standard deviation of
the data set.
This problem requires you to integerate multiple things together: arrays, loops, functions.
More specifically, you want to use loops to deal with input, save them to array, or calculate sum
and individual deviation,
and display results etc. in separate functions.
A sample run.
Please let me know how many grades you would like to input?
14
Input them one by one: 89 95 72 83 99 54 86 75 92 73 79 75 82 73.
Enter a grade: 89
Enter a grade: 95
Enter a grade: 72
Enter a grade: 83
Enter a grade: 99
Enter a grade: 54
Enter a grade: 86
Enter a grade: 75
Enter a grade: 92
Enter a grade: 73
Enter a grade: 79
Enter a grade: 75
Enter a grade: 82
Enter a grade: 73
The sum is: a number here.
The mean is: 80.5
GRADE INDIVIDUAL DEVIATION
89 8.5
95 14.5
72 -8.5
83 2.5
99 18.5
54 -26.5
86 5.5
75 -5.5
92 11.5
73 -7.5
79 -1.5
75 -5.5
82 1.5
73 -7.5
The variance is: 124.679
standard deviation: 11.166
Solution
Edit & Run
#include #include "vector.h" //link to vector.h file (no changes since lab03) using
namespace std; int main() { //Function for average double avg ( vector& v ) { double
return_value = 0.0; int n = v.size(); for ( int i=0; i < n; i++) {
return_value += v[i]; } return ( return_value / size); }
//****************End of average funtion**************** //Function for variance
double variance ( vector& v , double mean ) { double sum = 0.0; double temp =0.0;
double var =0.0; for ( int j =0; j <= v-1; j++) { temp = pow(v[j] -
mean),2); sum += temp; } return var = sum/(v.size() -2); }
//****************End of variance funtion**************** //****************main
from lab03**************** vector v; //creates vector of floats v.size(100); //size
100 vector of floats //Get input from user cout << "Please input any number: " << endl;
for (float i=0; getFloat() != ' '; i++) { cin >> v[i]; } //****************end of
main from lab03**************** }
Edit & Run

More Related Content

Similar to Write a C++ program to get input of a data set of 14 double valu.pdf

JavaHTP7e_1313_DDP.ppt
JavaHTP7e_1313_DDP.pptJavaHTP7e_1313_DDP.ppt
JavaHTP7e_1313_DDP.ppt
DrTouseefTahir
 
Effective PHP. Part 5
Effective PHP. Part 5Effective PHP. Part 5
Effective PHP. Part 5
Vasily Kartashov
 
Chapter 2
Chapter 2Chapter 2
Intro to programing with java-lecture 3
Intro to programing with java-lecture 3Intro to programing with java-lecture 3
Intro to programing with java-lecture 3
Mohamed Essam
 
Ch08
Ch08Ch08
Csci101 lect08b matlab_programs
Csci101 lect08b matlab_programsCsci101 lect08b matlab_programs
Csci101 lect08b matlab_programs
Elsayed Hemayed
 
CMIS 102 HANDS-ON LAB WEEK 6 OVERVIEW THIS HANDS-ON LAB ALLOWS YOU TO FOLLOW ...
CMIS 102 HANDS-ON LAB WEEK 6 OVERVIEW THIS HANDS-ON LAB ALLOWS YOU TO FOLLOW ...CMIS 102 HANDS-ON LAB WEEK 6 OVERVIEW THIS HANDS-ON LAB ALLOWS YOU TO FOLLOW ...
CMIS 102 HANDS-ON LAB WEEK 6 OVERVIEW THIS HANDS-ON LAB ALLOWS YOU TO FOLLOW ...
JanuMorandy
 
OverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docxOverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docx
gerardkortney
 
System Verilog 2009 & 2012 enhancements
System Verilog 2009 & 2012 enhancementsSystem Verilog 2009 & 2012 enhancements
System Verilog 2009 & 2012 enhancements
Subash John
 
control statements of clangauge (ii unit)
control statements of clangauge (ii unit)control statements of clangauge (ii unit)
control statements of clangauge (ii unit)
Prashant Sharma
 
03b loops
03b   loops03b   loops
03b loops
Manzoor ALam
 
Copy of dti2143/dam31303 chap 1 problem solving and program design
Copy of dti2143/dam31303 chap 1 problem solving and program designCopy of dti2143/dam31303 chap 1 problem solving and program design
Copy of dti2143/dam31303 chap 1 problem solving and program design
alish sha
 
Csphtp1 04
Csphtp1 04Csphtp1 04
Csphtp1 04
HUST
 
Testing techniques
Testing techniquesTesting techniques
Testing techniques
RaginiRohatgi
 
LectureNotes-05-DSA
LectureNotes-05-DSALectureNotes-05-DSA
LectureNotes-05-DSA
Haitham El-Ghareeb
 
Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]
Palak Sanghani
 

Similar to Write a C++ program to get input of a data set of 14 double valu.pdf (16)

JavaHTP7e_1313_DDP.ppt
JavaHTP7e_1313_DDP.pptJavaHTP7e_1313_DDP.ppt
JavaHTP7e_1313_DDP.ppt
 
Effective PHP. Part 5
Effective PHP. Part 5Effective PHP. Part 5
Effective PHP. Part 5
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Intro to programing with java-lecture 3
Intro to programing with java-lecture 3Intro to programing with java-lecture 3
Intro to programing with java-lecture 3
 
Ch08
Ch08Ch08
Ch08
 
Csci101 lect08b matlab_programs
Csci101 lect08b matlab_programsCsci101 lect08b matlab_programs
Csci101 lect08b matlab_programs
 
CMIS 102 HANDS-ON LAB WEEK 6 OVERVIEW THIS HANDS-ON LAB ALLOWS YOU TO FOLLOW ...
CMIS 102 HANDS-ON LAB WEEK 6 OVERVIEW THIS HANDS-ON LAB ALLOWS YOU TO FOLLOW ...CMIS 102 HANDS-ON LAB WEEK 6 OVERVIEW THIS HANDS-ON LAB ALLOWS YOU TO FOLLOW ...
CMIS 102 HANDS-ON LAB WEEK 6 OVERVIEW THIS HANDS-ON LAB ALLOWS YOU TO FOLLOW ...
 
OverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docxOverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docx
 
System Verilog 2009 & 2012 enhancements
System Verilog 2009 & 2012 enhancementsSystem Verilog 2009 & 2012 enhancements
System Verilog 2009 & 2012 enhancements
 
control statements of clangauge (ii unit)
control statements of clangauge (ii unit)control statements of clangauge (ii unit)
control statements of clangauge (ii unit)
 
03b loops
03b   loops03b   loops
03b loops
 
Copy of dti2143/dam31303 chap 1 problem solving and program design
Copy of dti2143/dam31303 chap 1 problem solving and program designCopy of dti2143/dam31303 chap 1 problem solving and program design
Copy of dti2143/dam31303 chap 1 problem solving and program design
 
Csphtp1 04
Csphtp1 04Csphtp1 04
Csphtp1 04
 
Testing techniques
Testing techniquesTesting techniques
Testing techniques
 
LectureNotes-05-DSA
LectureNotes-05-DSALectureNotes-05-DSA
LectureNotes-05-DSA
 
Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]
 

More from arshiartpalace

Which plants contain lignified vascular tissue (Select all that appl.pdf
Which plants contain lignified vascular tissue (Select all that appl.pdfWhich plants contain lignified vascular tissue (Select all that appl.pdf
Which plants contain lignified vascular tissue (Select all that appl.pdf
arshiartpalace
 
Which of the neurotransmitters are metabotropic and which are ionotr.pdf
Which of the neurotransmitters are metabotropic and which are ionotr.pdfWhich of the neurotransmitters are metabotropic and which are ionotr.pdf
Which of the neurotransmitters are metabotropic and which are ionotr.pdf
arshiartpalace
 
What is the range of y= absolute value f(x) if f(x) = -x^2 And can .pdf
What is the range of y= absolute value f(x) if f(x) = -x^2 And can .pdfWhat is the range of y= absolute value f(x) if f(x) = -x^2 And can .pdf
What is the range of y= absolute value f(x) if f(x) = -x^2 And can .pdf
arshiartpalace
 
G. Will a pumping test that is run for seven days give more informati.pdf
G. Will a pumping test that is run for seven days give more informati.pdfG. Will a pumping test that is run for seven days give more informati.pdf
G. Will a pumping test that is run for seven days give more informati.pdf
arshiartpalace
 
What challenges, strengths, or weaknesses do you see Baxter Internat.pdf
What challenges, strengths, or weaknesses do you see Baxter Internat.pdfWhat challenges, strengths, or weaknesses do you see Baxter Internat.pdf
What challenges, strengths, or weaknesses do you see Baxter Internat.pdf
arshiartpalace
 
Three historical figures were identified as working with vita statist.pdf
Three historical figures were identified as working with vita statist.pdfThree historical figures were identified as working with vita statist.pdf
Three historical figures were identified as working with vita statist.pdf
arshiartpalace
 
What are postretirement benefits other than pensionsSolutionB.pdf
What are postretirement benefits other than pensionsSolutionB.pdfWhat are postretirement benefits other than pensionsSolutionB.pdf
What are postretirement benefits other than pensionsSolutionB.pdf
arshiartpalace
 
There are parts of a true sustained competitive advantage Ther.pdf
There are parts of a true sustained competitive advantage Ther.pdfThere are parts of a true sustained competitive advantage Ther.pdf
There are parts of a true sustained competitive advantage Ther.pdf
arshiartpalace
 
Frequency .java Word frequency counter package frequ.pdf
Frequency .java  Word frequency counter  package frequ.pdfFrequency .java  Word frequency counter  package frequ.pdf
Frequency .java Word frequency counter package frequ.pdf
arshiartpalace
 
The alternative hypothesis typically Corresponds to the presumed def.pdf
The alternative hypothesis typically  Corresponds to the presumed def.pdfThe alternative hypothesis typically  Corresponds to the presumed def.pdf
The alternative hypothesis typically Corresponds to the presumed def.pdf
arshiartpalace
 
Suppose the continuous random variable X has probability density func.pdf
Suppose the continuous random variable X has probability density func.pdfSuppose the continuous random variable X has probability density func.pdf
Suppose the continuous random variable X has probability density func.pdf
arshiartpalace
 
Drag and drop the phrases to the appropriate status during the cockin.pdf
Drag and drop the phrases to the appropriate status during the cockin.pdfDrag and drop the phrases to the appropriate status during the cockin.pdf
Drag and drop the phrases to the appropriate status during the cockin.pdf
arshiartpalace
 
Some bacteria have one or more flagella. What is true about these st.pdf
Some bacteria have one or more flagella. What is true about these st.pdfSome bacteria have one or more flagella. What is true about these st.pdf
Some bacteria have one or more flagella. What is true about these st.pdf
arshiartpalace
 
our company has an opening for a junior database administrator. As a.pdf
our company has an opening for a junior database administrator. As a.pdfour company has an opening for a junior database administrator. As a.pdf
our company has an opening for a junior database administrator. As a.pdf
arshiartpalace
 
Part ABriefly, explain the current hypotheses about how brown alg.pdf
Part ABriefly, explain the current hypotheses about how brown alg.pdfPart ABriefly, explain the current hypotheses about how brown alg.pdf
Part ABriefly, explain the current hypotheses about how brown alg.pdf
arshiartpalace
 
Please show the whole code... Im very confused. Matlab code for ea.pdf
Please show the whole code... Im very confused. Matlab code for ea.pdfPlease show the whole code... Im very confused. Matlab code for ea.pdf
Please show the whole code... Im very confused. Matlab code for ea.pdf
arshiartpalace
 
Monomeric single pass trans-membrane proteins generally span the bil.pdf
Monomeric single pass trans-membrane proteins generally span the bil.pdfMonomeric single pass trans-membrane proteins generally span the bil.pdf
Monomeric single pass trans-membrane proteins generally span the bil.pdf
arshiartpalace
 
Match the following to one or more layers of the Internet protocol st.pdf
Match the following to one or more layers of the Internet protocol st.pdfMatch the following to one or more layers of the Internet protocol st.pdf
Match the following to one or more layers of the Internet protocol st.pdf
arshiartpalace
 
Kent and Emily have a baby boy Dustin by in vitro fertilization. Dust.pdf
Kent and Emily have a baby boy Dustin by in vitro fertilization. Dust.pdfKent and Emily have a baby boy Dustin by in vitro fertilization. Dust.pdf
Kent and Emily have a baby boy Dustin by in vitro fertilization. Dust.pdf
arshiartpalace
 
Isabel Lopez started Biz Consulting, a new business, and completed th.pdf
Isabel Lopez started Biz Consulting, a new business, and completed th.pdfIsabel Lopez started Biz Consulting, a new business, and completed th.pdf
Isabel Lopez started Biz Consulting, a new business, and completed th.pdf
arshiartpalace
 

More from arshiartpalace (20)

Which plants contain lignified vascular tissue (Select all that appl.pdf
Which plants contain lignified vascular tissue (Select all that appl.pdfWhich plants contain lignified vascular tissue (Select all that appl.pdf
Which plants contain lignified vascular tissue (Select all that appl.pdf
 
Which of the neurotransmitters are metabotropic and which are ionotr.pdf
Which of the neurotransmitters are metabotropic and which are ionotr.pdfWhich of the neurotransmitters are metabotropic and which are ionotr.pdf
Which of the neurotransmitters are metabotropic and which are ionotr.pdf
 
What is the range of y= absolute value f(x) if f(x) = -x^2 And can .pdf
What is the range of y= absolute value f(x) if f(x) = -x^2 And can .pdfWhat is the range of y= absolute value f(x) if f(x) = -x^2 And can .pdf
What is the range of y= absolute value f(x) if f(x) = -x^2 And can .pdf
 
G. Will a pumping test that is run for seven days give more informati.pdf
G. Will a pumping test that is run for seven days give more informati.pdfG. Will a pumping test that is run for seven days give more informati.pdf
G. Will a pumping test that is run for seven days give more informati.pdf
 
What challenges, strengths, or weaknesses do you see Baxter Internat.pdf
What challenges, strengths, or weaknesses do you see Baxter Internat.pdfWhat challenges, strengths, or weaknesses do you see Baxter Internat.pdf
What challenges, strengths, or weaknesses do you see Baxter Internat.pdf
 
Three historical figures were identified as working with vita statist.pdf
Three historical figures were identified as working with vita statist.pdfThree historical figures were identified as working with vita statist.pdf
Three historical figures were identified as working with vita statist.pdf
 
What are postretirement benefits other than pensionsSolutionB.pdf
What are postretirement benefits other than pensionsSolutionB.pdfWhat are postretirement benefits other than pensionsSolutionB.pdf
What are postretirement benefits other than pensionsSolutionB.pdf
 
There are parts of a true sustained competitive advantage Ther.pdf
There are parts of a true sustained competitive advantage Ther.pdfThere are parts of a true sustained competitive advantage Ther.pdf
There are parts of a true sustained competitive advantage Ther.pdf
 
Frequency .java Word frequency counter package frequ.pdf
Frequency .java  Word frequency counter  package frequ.pdfFrequency .java  Word frequency counter  package frequ.pdf
Frequency .java Word frequency counter package frequ.pdf
 
The alternative hypothesis typically Corresponds to the presumed def.pdf
The alternative hypothesis typically  Corresponds to the presumed def.pdfThe alternative hypothesis typically  Corresponds to the presumed def.pdf
The alternative hypothesis typically Corresponds to the presumed def.pdf
 
Suppose the continuous random variable X has probability density func.pdf
Suppose the continuous random variable X has probability density func.pdfSuppose the continuous random variable X has probability density func.pdf
Suppose the continuous random variable X has probability density func.pdf
 
Drag and drop the phrases to the appropriate status during the cockin.pdf
Drag and drop the phrases to the appropriate status during the cockin.pdfDrag and drop the phrases to the appropriate status during the cockin.pdf
Drag and drop the phrases to the appropriate status during the cockin.pdf
 
Some bacteria have one or more flagella. What is true about these st.pdf
Some bacteria have one or more flagella. What is true about these st.pdfSome bacteria have one or more flagella. What is true about these st.pdf
Some bacteria have one or more flagella. What is true about these st.pdf
 
our company has an opening for a junior database administrator. As a.pdf
our company has an opening for a junior database administrator. As a.pdfour company has an opening for a junior database administrator. As a.pdf
our company has an opening for a junior database administrator. As a.pdf
 
Part ABriefly, explain the current hypotheses about how brown alg.pdf
Part ABriefly, explain the current hypotheses about how brown alg.pdfPart ABriefly, explain the current hypotheses about how brown alg.pdf
Part ABriefly, explain the current hypotheses about how brown alg.pdf
 
Please show the whole code... Im very confused. Matlab code for ea.pdf
Please show the whole code... Im very confused. Matlab code for ea.pdfPlease show the whole code... Im very confused. Matlab code for ea.pdf
Please show the whole code... Im very confused. Matlab code for ea.pdf
 
Monomeric single pass trans-membrane proteins generally span the bil.pdf
Monomeric single pass trans-membrane proteins generally span the bil.pdfMonomeric single pass trans-membrane proteins generally span the bil.pdf
Monomeric single pass trans-membrane proteins generally span the bil.pdf
 
Match the following to one or more layers of the Internet protocol st.pdf
Match the following to one or more layers of the Internet protocol st.pdfMatch the following to one or more layers of the Internet protocol st.pdf
Match the following to one or more layers of the Internet protocol st.pdf
 
Kent and Emily have a baby boy Dustin by in vitro fertilization. Dust.pdf
Kent and Emily have a baby boy Dustin by in vitro fertilization. Dust.pdfKent and Emily have a baby boy Dustin by in vitro fertilization. Dust.pdf
Kent and Emily have a baby boy Dustin by in vitro fertilization. Dust.pdf
 
Isabel Lopez started Biz Consulting, a new business, and completed th.pdf
Isabel Lopez started Biz Consulting, a new business, and completed th.pdfIsabel Lopez started Biz Consulting, a new business, and completed th.pdf
Isabel Lopez started Biz Consulting, a new business, and completed th.pdf
 

Recently uploaded

LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 

Recently uploaded (20)

LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 

Write a C++ program to get input of a data set of 14 double valu.pdf

  • 1. Write a C++ program to get input of a data set of 14 double values (grades) from the standard input device (the keyboard), then calculate and report the sum and the mean of the data set, then the individual DEVIATION of each individual input with respect to the mean, the variance of the dataset, and finally the standard deviation of the data set. This problem requires you to integerate multiple things together: arrays, loops, functions. More specifically, you want to use loops to deal with input, save them to array, or calculate sum and individual deviation, and display results etc. in separate functions. A sample run. Please let me know how many grades you would like to input? 14 Input them one by one: 89 95 72 83 99 54 86 75 92 73 79 75 82 73. Enter a grade: 89 Enter a grade: 95 Enter a grade: 72 Enter a grade: 83 Enter a grade: 99
  • 2. Enter a grade: 54 Enter a grade: 86 Enter a grade: 75 Enter a grade: 92 Enter a grade: 73 Enter a grade: 79 Enter a grade: 75 Enter a grade: 82 Enter a grade: 73 The sum is: a number here. The mean is: 80.5 GRADE INDIVIDUAL DEVIATION
  • 3. 89 8.5 95 14.5 72 -8.5 83 2.5 99 18.5 54 -26.5 86 5.5 75 -5.5 92 11.5 73 -7.5 79 -1.5 75 -5.5
  • 4. 82 1.5 73 -7.5 The variance is: 124.679 standard deviation: 11.166 Write a C++ program to get input of a data set of 14 double values (grades) from the standard input device (the keyboard), then calculate and report the sum and the mean of the data set, then the individual DEVIATION of each individual input with respect to the mean, the variance of the dataset, and finally the standard deviation of the data set. This problem requires you to integerate multiple things together: arrays, loops, functions. More specifically, you want to use loops to deal with input, save them to array, or calculate sum and individual deviation, and display results etc. in separate functions. A sample run. Please let me know how many grades you would like to input? 14 Input them one by one: 89 95 72 83 99 54 86 75 92 73 79 75 82 73. Enter a grade: 89
  • 5. Enter a grade: 95 Enter a grade: 72 Enter a grade: 83 Enter a grade: 99 Enter a grade: 54 Enter a grade: 86 Enter a grade: 75 Enter a grade: 92 Enter a grade: 73 Enter a grade: 79 Enter a grade: 75 Enter a grade: 82
  • 6. Enter a grade: 73 The sum is: a number here. The mean is: 80.5 GRADE INDIVIDUAL DEVIATION 89 8.5 95 14.5 72 -8.5 83 2.5 99 18.5 54 -26.5 86 5.5 75 -5.5
  • 7. 92 11.5 73 -7.5 79 -1.5 75 -5.5 82 1.5 73 -7.5 The variance is: 124.679 standard deviation: 11.166 Write a C++ program to get input of a data set of 14 double values (grades) from the standard input device (the keyboard), then calculate and report the sum and the mean of the data set, then the individual DEVIATION of each individual input with respect to the mean, the variance of the dataset, and finally the standard deviation of the data set. This problem requires you to integerate multiple things together: arrays, loops, functions. More specifically, you want to use loops to deal with input, save them to array, or calculate sum and individual deviation, and display results etc. in separate functions. A sample run.
  • 8. Please let me know how many grades you would like to input? 14 Input them one by one: 89 95 72 83 99 54 86 75 92 73 79 75 82 73. Enter a grade: 89 Enter a grade: 95 Enter a grade: 72 Enter a grade: 83 Enter a grade: 99 Enter a grade: 54 Enter a grade: 86 Enter a grade: 75 Enter a grade: 92 Enter a grade: 73
  • 9. Enter a grade: 79 Enter a grade: 75 Enter a grade: 82 Enter a grade: 73 The sum is: a number here. The mean is: 80.5 GRADE INDIVIDUAL DEVIATION 89 8.5 95 14.5 72 -8.5 83 2.5 99 18.5
  • 10. 54 -26.5 86 5.5 75 -5.5 92 11.5 73 -7.5 79 -1.5 75 -5.5 82 1.5 73 -7.5 The variance is: 124.679 standard deviation: 11.166 Solution Edit & Run
  • 11. #include #include "vector.h" //link to vector.h file (no changes since lab03) using namespace std; int main() { //Function for average double avg ( vector& v ) { double return_value = 0.0; int n = v.size(); for ( int i=0; i < n; i++) { return_value += v[i]; } return ( return_value / size); } //****************End of average funtion**************** //Function for variance double variance ( vector& v , double mean ) { double sum = 0.0; double temp =0.0; double var =0.0; for ( int j =0; j <= v-1; j++) { temp = pow(v[j] - mean),2); sum += temp; } return var = sum/(v.size() -2); } //****************End of variance funtion**************** //****************main from lab03**************** vector v; //creates vector of floats v.size(100); //size 100 vector of floats //Get input from user cout << "Please input any number: " << endl; for (float i=0; getFloat() != ' '; i++) { cin >> v[i]; } //****************end of main from lab03**************** } Edit & Run