izabella.pearson 0 Newbie Poster

Okay so I have all of the coding and logic down except for ONE little part. I can not figure out how to actually implement my functions into the main because I keep getting errors that have to do with pointers. Please help! The point of the program is to convert and inputted name into soundex code!

here is my code:

#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

string name;
void duplicate(string name[]);
void convert(string name);
void remove(string name[]);
void step_one(string* name);

int main()
{
    cout << "Enter name" << endl;
    cin >> name;

return 0;
}

void step_one(string* name)
{
    for (; name; name++)
    {    
    convert(*name);    
    }
}

void duplicate(string name[])
{
for(int i=0; i<10; i++)
    {
    for(int c=1; c<6 ; c++)
        {
        if (name[i][c] == name[i][c-1])
        name[i][c] = name[i][c+1];       
        }
    }
}

void remove(string name[])
{

    for(int i = 0; i < 10; i++)
    {
        for(int c = 1; c < 6; c++)
        {
        if (isalpha(name[i][c]))
        name[i][c] = name[i][c+1];
        }       
    }
}

void convert(string name)
{
    for (int i = 1; i < name.length(); i++)
    {
        switch(name[i])
        {
            case 'b': case 'f':
            case 'p': case 'v':
                name[i] = '1';
                break;
            case 'c': case 'q':
            case 'g': case 's':
            case 'j': case 'x':
            case 'k': case 'z':
                name[i] = '2';
                break;
            case 'd': case 't':
                name[i] = '3';
                break;
            case 'l':
                name[i] = '4';
                break;
            case 'm': case 'n':
                name[i] = '5';
                break;
            case 'r':
                name[i] = '6';
                break;
        }
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.