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

c++use array Create a code segment (only the code needed to fulfill the given re

ID: 3587896 • Letter: C

Question

c++use array

Create a code segment (only the code needed to fulfill the given requirements) in the box below. We will place the code into our main) to see if it is correct. Declare the following arrays: tempsarray of 10 floating point elements initialized with -459.67 (absolute zero in Fahrenheit) colors array to hold strings "Red" "Blue", "Green", "Cyan", and "Magenta" in that order. fib integer array of 20 elements where first two elements are e and I. The other elements are the sum of the previous two elements. E.g. fib[2] -fib[e] + fib[1]

Explanation / Answer

float temps[10];
for(int i=0;i<10;i++){
  temps[i]=-459.67;
}

string colors[]={"Red","Blue","Green","Cyan","Magenta"};

int fib[20];
fib[0]=1;
fib[1]=1;

for(int i=2;i<20;i++){
  fib[i] = fib[i-1]+fib[i-2];
}

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