Number 1 in C++ Develop a statistical library for data analysis as we discussed
ID: 3758527 • Letter: N
Question
Number 1 in C++
Develop a statistical library for data analysis as we discussed in the class and as shown in lecture Sample header file is available in slide 41 and functions file with sample code for one function is in slide 42. Notice that you must use the bubble sort algorithm for sort function- (pseudocode is provided in slide 23). Implement sample application of the statistical library that performs some calculations on students' GPAs data set given in slide number 46 (sample file gpa.c is provided). Submission: You need to submit three C files: header file, the .c source file -functions definition, the main program( gpa.c) and the Dev C++ project (.dev). You need also to submit a snapshot of the output in the command prompt window with format similar to output appeared in slide 48. When an array is passed to a function, what is actually passed? The array a in Program 10.9 (08-Arrays-Slides) contains the daily page accessing numbers for a Web page in a given five-week period. Write a program to calculate the mean value for the number of accesses for each day of the week.Explanation / Answer
#include <stdio.h>
int main()
{
int array[100], n, c, d, swap;
printf("Enter number of elements ");
scanf("%d", &n);
printf("Enter %d integers ", n);
for (c = 0; c < n; c++)
scanf("%d", &array[c]);
for (c = 0 ; c < ( n - 1 ); c++)
{
for (d = 0 ; d < n - c - 1; d++)
{
if (array[d] > array[d+1]) /* For decreasing order use < */
{
swap = array[d];
array[d] = array[d+1];
array[d+1] = swap;
}
}
}
printf("Sorted list in ascending order: ");
for ( c = 0 ; c < n ; c++ )
printf("%d ", array[c]);
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.