{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lee_assig21

# Lee_assig21 - cout<<endl<<"The new scores...

This preview shows pages 1–2. Sign up to view the full content.

Sheet1 Page 1 //Cheu Lee Assig 21 #include <iostream> #include <cmath> using namespace std int main() { int a=0 while (a !=3) { int choice cout <<"+----------------------------------------------------------+"<<endl cout <<"| 1. Curving 15 test scores |"<<endl cout <<"| 2. Find the standard deviation |"<<endl cout <<"| 3. Exit |"<<endl cout <<"+----------------------------------------------------------+"<<endl cout <<"Plese make a selection, 1, 2, 3: " cin >>choice if (choice !=3) { switch (choice) { case 1: { double scores[15]={0}, max=scores[0] cout <<endl<<"Please enter five scores: "<<endl for (int i=0 i<15 i++) { cin >>scores[i] if (scores[i]>max) max=scores[i] m } cout.setf (ios::fixed) cout.precision (0)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cout <<endl<<"The new scores are: " for (int k=0 k<15 k++) { scores[k]=(scores[k]/max)*100 cout <<scores[k]<<" " } cout <<endl<<endl break } case 2: { double num[5]={0}, sum=num[0], mean int n=0 cout <<endl<<"Enter 5 consecutive numbers: "<<endl for (int i=0 i<5 i++) { cin >>num[i] sum+=num[i] Sheet1 Page 2 n+=1 } mean=sum/n double d=0 for (int k=0 k<n k++) { d+=(num[k]-mean)*(num[k]-mean) } double c=d/((n-1)*0.1) double e=sqrt(c) cout <<"Standard deviation is: "<<e<<endl break } } } if (choice<1 || choice>3) cout <<endl<<"Invalid input."<<endl<<endl if (choice==3) a=choice } cout <<endl<<"Program existed."<<endl<<endl return 0 }...
View Full Document

{[ snackBarMessage ]}

### Page1 / 2

Lee_assig21 - cout<<endl<<"The new scores...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online