2021-10-31

I am struggling with c++ [closed]

I am doing this assignment but I am not sure if I am doing the right thing. See the questions below. And some of my solutions.

Scenario
A group of geologist are interested in a C++ application that is capable of accepting and processing data related to sites that they monitor across the island. A value between 1 and 10 (inclusively) is used to represent a geologist’s observation for an activity at a site. At minimum, each geologist will observe 10 sites for 10 days. Using an array, the minimum data for a geologist’s site could be represented as follow:

1 2 3 4 5 6 7 8 9 10
1 5 7 10 3 10 2 2 5 7 10
2 6 5 10 5 7 1 6 10 5 4
3 8 2 7 5 6 2 1 4 2 4
4 9 10 8 8 4 8 8 2 5 5
5 6 7 5 10 2 10 1 4 6 6
6 1 5 6 10 2 8 7 2 8 3
7 8 2 3 7 6 3 1 1 9 6
8 1 1 5 8 10 7 2 2 7 1
9 3 1 10 9 2 5 1 2 5 8
10 5 7 6 3 1 1 8 8 2 10
A

For example, at site 1 on day 1 (A11) and at site 9 on day 7 (A97), the values 5 and 1 are seen respectively – indicating the geologist’s rating for an activity at site 1 and site 9.

Tasks
You will implement a menu-driven C++ application that will model the following tasks to be accomplished by each geologist.

  • Create A. Upon the user selecting this option, your C++ application will create an integer pointer variable called A within your application’s main function. This pointer variable will be used to store the values representing a geologist’s observation for each site for each day. Your solution is required to call a function which accepts two integer values as its arguments, m and n, and returns a pointer to the newly created m by n integer array. You are to ensure that values for the minimum days and sites are validated before creating the m by n integer array. Note, the returned result of your function is expected to be assigned to A in your main function.
  • Populate A. Upon the user selecting this option, your main function will call another function to assist it in randomly assigning integer values to each location in A. You are to ensure that only valid values are generated and stored – as used by a geologist for recording their observations.
  • Scale A. Upon the user selecting this option, your main function will call another function to assist it in performing a scalar multiplication – this is to be done by multiplying all integer values in A with a user’s inputted integer value. Only values between 2 and 10 (inclusively) are to be accepted and used to perform this scalar multiplication.
  • Compute percentage. Upon the user selecting this option, your main function will display the highest and lowest values in A, and then create an n by 1 integer array called percentage. Your solution will then prompt the user to enter a value within the range of the highest and lowest displayed values. Next, for each site in A, your main function will compute and store the percentage of values that are greater than the user’s accepted value. Your solution will store the respective percentages obtained for each site in the array called percentage.
  • Exit program. Upon the user selecting this option, your main function will prompt the user to confirm their choice to exit your application. Only if the user confirms the choice to exit should your application close; otherwise, it repeats the menu options for your user.

Solutions



from Recent Questions - Stack Overflow https://ift.tt/3GEcpmX
https://ift.tt/eA8V8J

No comments:

Post a Comment