As others have said, it's important to start simple and then work your way to the solution step by step. Some knowledge of C++ is required, which can be acquired in this project using a practical example.
Here are some basic first steps:
1. find a data structure that represents the 15-puzzle. This could be a 4x4 matrix, for example. At the beginning, 15 cells are given a value and
the free field could be defined as 0. A flexible data structure in C++ for the data field, which also makes it acceptable to change the dimension, would be a vector. It could look something like this:
class PuzzleGrid {
public:
PuzzleGrid(int rows, int cols) : grid(rows, std::vector<int>(cols, 0)) {}
void setValue(int row, int col, int value) { grid[row][col] = value; }
int getValue(int row, int col) const { return grid[row][col]; }
private:
std::vector<std::vector<int>> grid; };
struct Point {
Point(int x, int y): x(x), y(y) {} int x, y; };
struct PuzzleState {
PuzzleState(const PuzzleGrid& data, const Point& emptyPos): puzzleData(data), emptyCellPos(emptyPos) {}
PuzzleGrid puzzleData; Point emptyCellPos; };
2. write an initial test program that uses the data structure. You would also need a function to display the field on the screen, as well as a function that shuffles the field. Functions are also needed to move the empty field in all directions (up, down, left, right), if possible.The border must of course be taken into account when moving.
3. a function is needed that can evaluate the current state of a field. Here you could use the distance as the sum of the horizontal and vertical distances of each puzzle piece from its final position.
4. after calculating the distances of each piece to the target position, you need to use the A* algorithm to find the optimal solution path.
Set up a workable framework up to this point and think about the implementation of the A*. If further questions arise, it is best to open a new question.