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

can you please type the whole code and leave space where i have to write my name

ID: 3819780 • Letter: C

Question

can you please type the whole code and leave space where i have to write my name in

Consider the following declaration: (1, 2) int account Num[75]; In this declaration, identify the following: a. The array name. b. The array size. c. The data type of each array component. d. The range of values for the index of the array. e. The index of the first element. f. The index of the last element. Write C++ statement(s) to do the following: (1, 2) a. Declare an array alpha of 50 components of type int. b. Initialize each component of alpha to-1. c. Output the value of the first component of the array alpha. d. Set the value of the twenty-fifth component of the array alpha to 62. e. Set the value of the tenth component of alpha to three times the value of the fiftieth component of alpha plus 10. f. Use a for loop to output the value of a component of f its alpha index is a multiple of 2 or 3. g. Output the value of the last component of alpha. h. Output the value of the alpha so that 15 components per line are printed. i. Use a for loop to increment every other element (the even indexed elements). j. Use a for loop to create a new array, diffAlpha, whose elements are the differences between consecutive elements in alpha.

Explanation / Answer

2. Consider the declartion

int accountNum[75];

a. The array name is accountNum
b. The array size is 75
c. The data type of each array component is int
d. The range of values for the index of the array 0 to 74(size-1).
e. The index of first element is 0(start index)
f. The index of the last element 74(size-1)

6. C++ statement(s)
a. int alpha[50]. //declares array alpha of 50 elements of type int

b. for(int i=0;i<50;i++) //initializes each element to 1
alpha[i]=-1;

c. cout<<alpha[0] ; //outputs the first element of the array

d. alpha[24] =10; //sets 25 element of array alpha to 10

e. alpha[9]= 3 * alpha[4] +10

f. for(int i=0;i<50;i++)
if(i%2==0 || i%3==0) //checking index i is a multiple of 2 or 3
cout<<i<<" "; //prints i value if i is a multiple of 2 or 3
  
g. cout<<alpha[49]; //prints the last component of alpha (size-1)

h. for(int j=0;j<50;j++)
{
cout<<alph[j]<<" ";
if(j%14==0) //checking j is a 15th component
cout<<" "; //new line
}

i. for(int i=2;i<50;i+=2) //0 is not an even number and incremets to even indexed elements

j. int diffAlpha[49]; //creating a new array
for(int i=0;i<49;i++)
diffAlpha[i]=alpha[i]-alpha[i+1]; //compute difference between consecutive elements

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote