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

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

ID: 3554603 • Letter: 1

Question

1.Write C++ statements to do the following:
a. Declare an array alpha of 15 components of type int.
b. Set the value of the 4th component of the alpha array to three times the value of the 8th component minus 57.
c. Output alpha so that five components appear on each line.

2.What is stored in the list array after the following code executes?

int list[5];
for(int j = 0; j < 5; j++)
{
list[j] = 2 * j + 5;
if (j % 2 == 0)
{
list[j] = list[j] - 3;
}
}

3.Write a loop that finds the largest element in an integer array called data containing 100 elements.

Explanation / Answer

1. a) int alpha[15];

b) alpha[3]=3*arr[7] - 57;

c) for(i=1;i<=15;i++)

{

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

if(i%5==0)

cout<<endl;

2. list contains 5,7,6,11,10

3. int max=data[0];

for(int i=1;i<100;i++)

{

if(max<arr[i])

max=arr[i]

}

return max;