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

Write a program using the following specifications: a. Using good style, write t

ID: 3531707 • Letter: W

Question

Write a program using the following specifications:


a. Using good style, write the necessary statements to declare an array, called score, of 50 integer numbers.

b. Write a function to read strict positive values from the input file "scores.txt" into the array (ignore the negative values).

c. Write a function that takes the array score and two variables s1 and s2 and returns the number of values in score that are between s1 and s2, including s1 and s2. This function has four parameters: s1, s2, score and size.

d. Write the main function that calls the previous two sub-functions. Be sure to declare and read the values that need to be passed to the functions.

Explanation / Answer

first declare any array and then later use this part to get a number from that array

int size = 10;

int *elements = malloc(sizeof(int)*size);


// inizialize

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

elements[i] = i;


for (int i = size - 1; i > 0; --i) {

// generate random index

int w = rand()%i;

// swap items

int t = elements[i];

elements[i] = elements[w];

elements[w] = t;

}a

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