FDS Report
FDS Report
Group Members
Content Page
Aim 3
Theory 3-5
Objectives 5
Algorithm 5-6
Codet 7-9
Aim:
Theory:
2. 2D Arrays (Vectors):
The puzzle grid is represented as a 2D vector of strings, which
allows it to store both arithmetic symbols and unknown
variables. This structure makes it easy to access and manipulate
the elements based on player input.
Objectives:
Algorithm:
3. Game Loop:
- For each variable (`a`, `b`, `c`, `d`):
1. Ask the player to enter the value for the variable.
2. Validate the input:
- If the value is incorrect, prompt the user to try again.
- If the value is correct, update the grid with the new value
and display it.
3. Continue asking until the player provides the correct value.
5. End of Game:
- After all variables are solved, display a congratulatory
message and exit the game.
Code:
include <iostream>
include <vector>
include <string>
using namespace std;
int main() {
// Initialize the grid with arithmetic operations and variables
vector<vector<string>> grid = {
{"2", "+", "a", "=", "5"},
{"b", "-", "3", "=", "2"},
{"4", "+", "c", "=", "11"},
{"d", "+", "6", "=", "8"}
};
Conclusion: