I've been working on a C++ program to make morphology changes to a text file that the user chooses, but while making this program I've ran into an issue where a different function that essentially does its purpose the same way as the other functions, wont print. Even though it should be printing.
Here is what I have so far:
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
//look up line by line parsing
using namespace std;
void replacee(vector<vector<char>> &vec, char oldd, char neww)
{
    for (vector<char> &v : vec) // reference to innver vector
    {
        replace(v.begin(), v.end(), oldd, neww); // standard library 
algorithm
    }
}
void dialationn(vector<vector<char>> &vec, char suspect, char n)
{
    for (int i = 0; i < vec.size(); i ++) {
            for (int j = 0; j < vec[i].size(); j++) {
                if (vec[i][j] == suspect) {
                    if (i > 0) {
                     vec[i-1][j] = n;
                    }
                    if (j > 0) {
                     vec[i][j-1] = n;
                    }
                    if (i + 1<vec.size()) {
                        vec[i+1][j] = n;
                    }
                    if (j + 1<vec[i].size()) {
                        vec[i][j+1] = n;
                    }
                }
            }
        }
        replacee(vec, n, suspect);
}    
int main(int argc, char* argv[]) {
    fstream fin; char ch;
    string name (argv[1]); //File Name.
    vector<vector<char>> data;
    // 2D Vector.
    vector<char> temp;
    // Temporary vector to be pushed 
    // into vec, since its a vector of vectors.
    fin.open(name.c_str(),ios::in);
    // Assume name as an arbitary file.
    string argument2 (argv[2]);
    string argument3 (argv[3]);
    string argument4 (argv[4]);
    while(fin)
    {
        ch = fin.get();
        if(ch!='\n') {
            temp.push_back(ch);
        }
        else 
        { 
            data.push_back(temp); 
            temp.clear(); 
        }
    }
    if (argument2 == "replace") {
        replacee(data, argument3[0], argument4[0]);
        for (int i = 0; i < data.size(); i ++) {
            for (int j = 0; j < data[i].size(); j++) {
                cout << data[i][j];
            }
            cout << endl;
        }
    } else if (argument2 == "dilate") {
        dialationn(data, argument3[0], 'i');
        for (int m = 0; m < data.size(); m ++) {
            for (int n = 0; n < data[m].size(); n++) {
                cout << data[m][n];
            }
            cout << endl;
        }
    }
    fin.close();
} 
Note: the reason I'm so confused is because the printing method I used in the int main works for replace, but doesn't work for dilation. I don't see any major differences that occur between the two functions for them to not be printing. I even made a small test program and it worked in that one:
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
using namespace std;
void replacee(vector<vector<char>> &vec, char oldd, char neww)
{
    for (vector<char> &v : vec) 
    {
        replace(v.begin(), v.end(), oldd, neww); 
    }
}
void dialationn(vector<vector<char>> & vec, char suspect, char n)
{
    for (int i = 0; i < vec.size(); i ++) {
            for (int j = 0; j < vec[i].size(); j++) {
                if (vec[i][j] == suspect) {
                    if (i > 0) {
                     vec[i-1][j] = n;
                    }
                    if (j > 0) {
                     vec[i][j-1] = n;
                    }
                    if (i + 1<vec.size()) {
                        vec[i+1][j] = n;
                    }
                    if (j + 1<vec[i].size()) {
                        vec[i][j+1] = n;
                    }
                }
            }
        }
        replacee(vec, n, suspect);
}
int main(int argc, char* argv[]) 
{
    vector<vector<char>> data(5, std::vector<char>(9,'.'));
    data[2][4] = 'x';
    dialationn(data, 'x', 'i');
    for (int i = 0; i < data.size(); i ++) {
            for (int j = 0; j < data[i].size(); j++) {
                cout << data[i][j];
            }
            cout << endl;
        }
} 
Since this is being done with inputs from the command line, they go as follows for the replace function:
./a.exe input1.txt replace (OLD LETTER NEEDING TO BE REPLACED) (NEW LETTER REPLACING)
For the dilation function:
./a.exe input1.txt dilate (SYMBOL IN FILE TO DILATE)
input1.txt is as follows:
.........
.........
.........
.........
....X....
.........
.........
.........
.........
 
    