Help with a bit a of code I'm trying to make

First of all here's the code
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
#include <string>
using namespace std;

int main()
{
    string ShoppingListItem[5]={"Cheese", "Fish", "Jucie", "Gravy", "Pepsi"};
        cout << ShoppingListItem[3] << endl;
        string item = ShoppingListItem;
        cout << "Your item has " << item.size() << "Characters in it" << endl;
}

I'm trying to make a simple program where the user chooses an item out of the array I've created (The array works fine) Then make it so that what ever item the user has chosen, it get's that item and says how many characters it has in it.
Similar to this bit of code
1
2
3
4
5
6
7
8
string word1 = "Game";
    string word2("Over");
    string word3(3, '!');

    string phrase = word1 + " " + word2 + word3;
    cout << "The phrase is: " << phrase << "\n\n";

    cout << "The phrase has " << phrase.size() << " characters in it.\n\n";

Is it even possible to do what I'm trying to do? Am I doing something that's impossible?
Here is some code that might help you.

1
2
cout << "Pick an item";
cin >> userChoice;


int numberOfLetters = ShoppingListItem[userChoice].size;



I may brought the point across a bit wrong but you've gave me an idea so thanks :D
Topic archived. No new replies allowed.