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

I have a final in c++ on wednseday and I need some help with the following revie

ID: 3583046 • Letter: I

Question

I have a final in c++ on wednseday and I need some help with the following review questions.

1. Write a line of code that declares an pointer to a double value

2.Now write a line of code that has your new pointer point to a double variable (call it double x) which has the value of 5.3 inside it

3. Now use your pointer to change the value of x to 15.4

4. If I asked you where in memory x is located— write two ways you might print that out to the console.

5. If I have int funArray[10], Write two ways we’ve learned access the value at the 5th index of funArray

For 6-9, the following questions walks you through parts of creating a class step by step. You may refer to functions and variables you have created in previous steps.

6. Let’s say you have a class named picture that represents a 200 pixel by 200 pixel grayscale image. Grayscale means it contains integer values from 0 (black) to 255 (white)) in memory (like a black and white version of the BGI picture we had in pesky tourist). What private variable(s) would have in your class to represent this?

7.Write a default constructor that initializes your picture to a white background by giving your private variable(s) values.

8. Write a public member function, called getPixel, that takes in a pixel location (think about what that means in a picture) and returns the grayscale value at that pixel location

9. Let’s say your picture class overloads operator== as a nonmember (can’t access pixel values directly), such that if two pictures have the same grayscale pixel value at each location, they are considered equal, otherwise they are considered unequal. Write this whole overloaded operator in the .cxx file.

10. Extra Credit long answer— pick ONE of the following

A) Write how you might design a class that represents a student at Old Westbury. Identify a problem domain and identify why your choice of private variables to represent this student, fits the given problem domain. Finally, identify the member functions you would write to manipulate these private variables.

B) Pick an example, OUTSIDE of class, of a problem that you think has a recursive solution and outline how you might solve the problem with recursion.

//Please answer this questions as soon as possible

Explanation / Answer

1) double *point = &value;

2)double x = 5.3
double *y = &x;

Here y is pointer to a double variable x