Need Help with extra credit project for class #1

Hello smart people!
So this is my first c++ class a=in college and i like c++ the most out of all the languages but professor put up extra credit which is really tough because I'm trash at c++ so far. I absolutely bombed the midterm and need to ace these extra credit problems to pass the class at this point.

Here are the assignments:

Project 1: Treasure Map

Implement a two dimensional treasure map.

Requesting Map Values
1) Request a map size between 5 and 9 inclusive.
- Validate the map size with a loop.

2) Request row/column coordinates for the treasure location.
- Validate X coordinates with a loop. X must be visible on the map.

The Treasure Map
1) Display the map using a nested loop (see example). - Treasure location is marked with an ‘X’. - Blank coordinates are be marked with a ‘-‘. - Row and column coordinate labels are displayed.

Example: Input Request and Map Display (input is bolded and italicized) Enter a map size between 5 and 9 inclusive: 9 Initial location of the treasure (row column): 4 3
0 - - - - - - - - -
1 - - - - - - - - -
2 - - - - - - - - -
3 - - - - - - - - -
4 - - - X - - - - -
5 - - - - - - - - -
6 - - - - - - - - -
7 - - - - - - - - -
8 - - - - - - - - -
0 1 2 3 4 5 6 7 8

Hints: - Note that coordinates range from 0 to map_size – 1. - Note that there are map_size + 1 rows and columns so that coordinate values can be displayed in the first column and last row.

The Option Menu
1) Display this option menu and handle it with a switch statement:

Example: Option Menu (input is bolded and italicized)
1) Update treasure coordinates (row/column)
2) Shift X (N S E W)
3) Exit Program

Select: 1

Handling the Option Menu
1) Option 1
- Request a new row and column. X must
- Validate X coordinates with a loop. X must be visible on the map.
- Once validated, update the X coordinate values.

2) Option 2
- Request a vector (direction and distance) (i.e. N 3 or W 2)
N/S directions will modify the row of X
E/W directions will modify the column of X
- Calculate the new X coordinates without overwriting the original values.
- Validate the new coordinates with a loop. X must be visible on the map.
- Once validated, update the X coordinate values.

3) Option 3
- Exit the menu loop and output “Exiting program.”
Program Flow
1) Request and validate the initial map values.
2) Loop the following until the user selects the exit option (sentinel loop):
a) Display the map.
b) Display and handle the option menu.

Example: Program Output (input is bolded and italicized)
Treasure Map
------------
Enter a map size between 5 and 9 inclusive: 10
Invalid map size.
Enter a map size between 5 and 9 inclusive: 9
Map size set to 9.
Initial location of X (row column): 10 1
Coordinates must be between 0 and 8.
Initial location of X (row column): 4 3
Treasure coordinates assigned to row 4 column 3.
0 - - - - - - - - -
1 - - - - - - - - -
2 - - - - - - - - -
3 - - - - - - - - -
4 - - - X - - - - -
5 - - - - - - - - -
6 - - - - - - - - -
7 - - - - - - - - -
8 - - - - - - - - -
0 1 2 3 4 5 6 7 8
1) Update treasure coordinates (row/column)
2) Shift X (N,S,E,W)
3) Exit program
Select: 1
Update location of X (row column): 13 5
Coordinates must be between 0 and 8.
Update location of X (row column): 5 5
0 - - - - - - - - -
1 - - - - - - - - -
2 - - - - - - - - -
3 - - - - - - - - -
4 - - - - - - - - -
5 - - - - - X - - -
6 - - - - - - - - -
7 - - - - - - - - -
8 - - - - - - - - -
0 1 2 3 4 5 6 7 8

1) Update treasure coordinates (row/column)
2) Shift X (N,S,E,W)
3) Exit program
Select: 2
Shift X (N,S,E,W) and unit number: S 8
Treasure cannot move beyond the map.
Shift X (N,S,E,W) and unit number: S 2
0 - - - - - - - - -
1 - - - - - - - - -
2 - - - - - - - - -
3 - - - - - - - - -
4 - - - - - - - - -
5 - - - - - - - - -
6 - - - - - - - - -
7 - - - - - X - - -
8 - - - - - - - - -
0 1 2 3 4 5 6 7 8
1) Update treasure coordinates (row/column)
2) Shift X (N,S,E,W)
3) Exit program
Select: 3
Exiting Program.
you need to write some code and ask a question about where you have trouble.
Topic archived. No new replies allowed.