Reference no: EM132209632
Write a program about color processing: first declare an enumeration type for colors red, green, blue and other colors in global.
Next write a function which initializes an array of color type.
There are two parameters for the function: an array of color type and an integer for array size.
The function will initialize all of elements of the array to red color. Next write a second function that will update the color value of an array. There are two parameters for the function: an array of color type and an integer for array size.
The function will update all of elements of the array as following: if the array index is divisible by 2, set the element to red color, if the array index is divisible by 3, set the element to green color, if the array index is divisible by 5, set the element to blue color, for all other index values, set the element to other color.
Next write another function that will output all of the array elements whose color values are red.
There are two parameters for the function: an array of color type and an integer for array size. Next write the main function.
In your main function, first declare a color array of size 100. Then call all of the above three functions with the array.
a. Declare a structure Gradelnfo to store student grade which contains 3 double data members: homework, tests, and exam.
b. Write a void function readGrade() with one parameter- oneGrade of type Gradelnfo.
The function will read data into the three members of oneGrade. Consider oneGrade should be passed by value or by reference.