I'm not really sure what's going wrong with my program here. It compiles without error but it won't even run the first function correctly. I have tried to ask some friends to help me out with this but they were of no help.
I am hoping someone could help me at least by showing me an error I have made but have not caught.
Header File (sieve.h):
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <vector>
using namespace std;
void findPrimeNumbers(int**, int);
void printPrimes(int**, int);
void findPrimeNumbers(int **arr, int n)
{
    for (int x = 2; x < n; x++){
       cout << " x is " << x;
        if (arr[0][x] == 1){
        int z = arr[1][x];
        cout << " z = " << z;
        for (int y = 2 * z; y < 40; y += z){
                cout << " y is " << y;
                arr[0][y] = 0;
            }
        }
    }
}
void printPrimes(int **arr, int n)
{
    for (int x = 0; x < n; x++){
        if (arr[0][x] == 1) 
            cout << arr[1][x] << " is a prime number" << endl;
    }
}
Main File (sieve.cpp):
#include "sieve.h"
using namespace std;
int main()
{
    int n=1;
    cout << "Please enter the maximum value:" << endl;
    cin >> n;
    vector<int> sir(n);
    cout << "You have selected the maximum size as:" << endl;
    cout << n << endl;
    //allocate the array
    int row = n;
    int col = n;
    int** arr = new int*[row];
    for(int i = 0; i < row; i++)
    {
        arr[i] = new int[col];
    }
    findPrimeNumbers(arr, n);
    printPrimes(arr, n);
    for (int j = 0; j < n; j++)
    {
        cout << " " << arr[0][j];
    }
    //deallocate the array
    for(int i = 0; i < row; i++)
    {
        delete[] arr[i];
        delete[] arr;
    }
    return 0;
}
Even the tiniest amount of help would be greatly appreciated!
 
     
    