Question
Program in C++ const int SIZE = 10; int nums[SIZE] = {5,4,2,7,6,8,5,2,8,14}; Write code to perform the following array operations (Note that the number of
Program in C++
const int SIZE = 10; int nums[SIZE] = {5,4,2,7,6,8,5,2,8,14};
Write code to perform the following array operations (Note that the number of clues vary, just because a [____] is not explicitly written in does not mean there should not be brackets).
//#1 Square each number ((i.e., multiply each by itself)
for (int i ___; i < _____; i++) {
____[i] = ______*_____;
}
//#2 Add a random number between zero and 10 to // each number.
_________________________________
_____ += ________;
//#3 Add to each number the number that follows in the // array. Skip the last value in the array.
for (int i = 0; i < _____; i++) {
_____ += ______[____];
}
//#4 Calculate the sum of all the numbers.
_____ ________ = ____;
for (int i = 0; i < SIZE; i++) {
______ += ________;
}
//#5 Display the largest number in the array
//Youre on your own here!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started