Access over 35 million academic & study documents

Design and implement a C++ program that accepts a pre defined number

Content type
User Generated
Rating
Showing Page:
1/2
Design and implement a C++ program that accepts a pre-
defined number of integers and prints the following
statistics about them: average, lowest, highest and
standard deviation. Your program must store the numbers
in an integer array.
Solution
#include <iostream>
#include<cmath>
using namespace std;
#define NUM_INT 5
int main() {
// your code goes here
int arr[NUM_INT];
int i;
cin>>arr[0];
int sum=arr[0],min=arr[0],max=arr[0];
for(i=1;i<NUM_INT;i++)
{
cin>>arr[i];
if(arr[i]<min)
min = arr[i];
if(arr[i]>max)

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/2

Sign up to view the full document!

lock_open Sign Up
Unformatted Attachment Preview
Design and implement a C++ program that accepts a pre defined number of integers and prints the following statistics about them: average, lowest, highest and standard deviation. Your program must store the numbers in an integer array. Solution #include #include using namespace std; #define NUM_INT 5 int main() { // your code goes here int arr[NUM_INT]; int i; cin>>arr[0]; int sum=arr[0],min=arr[0],max=arr[0]; for(i=1;i>arr[i]; if(arr[i]max) max = arr[i]; sum += arr[i]; } double mean = (sum*1.0)/NUM_INT; double sd=0; for(i= ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
I use Studypool every time I need help studying, and it never disappoints.

Studypool
4.7
Indeed
4.5
Sitejabber
4.4

Similar Documents