Sol6hw3b 1) Using the editor write and save a file xxxxdata.txt which looks like this: 78.3 59.5 89.2 72.5 95.3 100.0 This file contains the scores of 6 students in a quiz. ________________________________________________________________ 2) Write and save in a file named xxxxpe2.cpp a C++ program which consists of a main function and a function named stat. The main function should: a) Read the scores from the data file into an array scores[6]. b) Use the function void stat ( float scores[], float& xbar, float& x2bar ) to locate and return the average of the scores and the average of the squares of the scores. c) Print to the screen xbar and x2bar.. _________________________________________________________________ #include // 5 pts #include void stat( float scores[], float& xbar, float& x2bar); // 5 pts main( ) // 5 pts { // structure of main and declarations float scores[6]; float xbar, x2bar; int k; ifstream table("jyk0data.txt", ios:: in); // 10 pts for( k = 0 ; k <= 5 ; k++) // 15 pts table >> scores[k]; stat( scores, xbar, x2bar); // 10 pts cout << "\n\n the average score is: " << xbar << endl; // 10 pts cout << "\n\n the average of the squares of the scores is: " << x2bar<< endl; cout<<"\n\n enter e ( exit) to terminate "; // 5 pts char hold; cin >> hold; } void stat( float scores[], float& xbar, float& x2bar) // 5 pts { float sum1 = 0.0; // 5 pts float sum2 = 0.0; int k; for ( k=0; k<= 5; k++) // 15 pts { sum1 += scores[k]; sum2 += scores[k] * scores[k]; } xbar = sum1 / 6 ; // 5 pts x2bar = sum2 / 6; } /* THE DATA FILE IS: 78.3 59.5 89.2 72.5 95.3 100.0 This file contains the scores of 6 students in a quiz THE OUTPUT IS: the average score is: 82.4667 the average of the squares of the scores is: 6994.35 enter e ( exit) to terminate */