Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write C++ statements to do the following: a.) Declare an array alpha of 15 compo

ID: 3625656 • Letter: W

Question

Write C++ statements to do the following:

a.) Declare an array alpha of 15 components of type int.

b.) Output the value of the tenth component of the array alpha.

c.) Set the value of the fifth component of the array alpha to 35.

d.) Set the value of the ninth component of the array alpha to the sum of the sixth and thirteenth components of the array alpha.

e.) Set the value of the fourth component of the array alpha to three times the value of the eighth component minus 57.

f.) Output alpha so that five components per line are printed.

Explanation / Answer

.) Declare an array alpha of 15 components of type int.

int alpha[15];

b.) Output the value of the tenth component of the array alpha.

cout << alpha[9] << endl;

c.) Set the value of the fifth component of the array alpha to 35.

alpha[4] = 35;

d.) Set the value of the ninth component of the array alpha to the sum of the sixth and thirteenth components of the array alpha.

alpha[8] = alpha[5] + alpha[12];

e.) Set the value of the fourth component of the array alpha to three times the value of the eighth component minus 57.

alpha[3] = 3*alpha[7]-57;

f.) Output alpha so that five components per line are printed.

for(int i=0; i<15; i++)

{

cout << alpha[i] << " ";

if((i+1)%5==0)

cout <<endl;


}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote