Array help (algorithm)

  • 14 years ago

    Heres what I have so far 1) reads user input 2) assigns the input to the array 3) outputs the array

    What I want it to do is count the letters in the input and ignore any spaces that might occour..then delete any repetitive characters and fill a separate array (or vector) with the key and the remaining alphabet.

    CODE

    include

    include

    include

    using namespace std;

    int main() {

    string myName;
    cout << "Please enter your key: ";
    getline(cin,myName);
    
    
    string myArray[9][20];
    
    
    
    for (int i=0; i < myName.length();i++)
        myArray[0][i] = myName.at(i);
    
    for (int i = 0; i <9; i++)
    {
        for(int j=0; j<myName.length(); j++)
        {
                cout << myArray[i][j];
        }
    
                cout << endl;
    }
    
    return 0;
    

    }

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Walking on water and developing software from a specification are easy if both are frozen.” - Edward V Berard