Question: C + + , Array scoresArray has NUM _ SCORES numbers read from input. Array halfArray has half the size of scoresArray. Write a loop
CArray scoresArray has NUMSCORES numbers read from input. Array halfArray has half the size of scoresArray. Write a loop that iterates through halfArray and:
If the corresponding element in the first half of scoresArray is less than then assign the element in halfArray with
Otherwise, assign the element in halfArray with the corresponding element in the first half of scoresArray.
Ex: If the input is:
then the output is:
Original scores: Updated first half:
#include
#include
using namespace std;
int main
const int NUMSCORES ;
double scoresArrayNUMSCORES;
double halfArrayNUMSCORES ;
int i;
for i ; i NUMSCORES; i
cin scoresArrayi;
Your code goes here
cout "Original scores: ;
for i ; i NUMSCORES; i
cout fixed setprecision scoresArrayi;
cout endl;
cout "Updated first half: ;
for i ; i NUMSCORES ; i
cout fixed setprecision halfArrayi;
cout endl;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
