Multiple string search

I have problem as following: my program is supposed to read its adress book.
The book is string table - string book[40]. I want to let the user search it by first letter of name. I thought of comparing it like said in my book:
if(string[x]==input){cout<<string}.
But it is out of question here - because that [x] would be number of the string, not number of character inside it. Any idea how to pull this trick?
Thanks in advance :)
string[x]==input and cout<<string
is erroneous because string is a C++ type and should not be used as a variable name.

book[i][j] will give you a letter number j in i-th string
If what you want is this:
book has "one", "two", "three","something else"...
User Inputs 't'
Program outputs "two" and "three"

You should do this:
if (book[n][0]==input) cout << book[n] << '\n';
where n is the number of the string (you should go through all your strings in book) and 0 is the first character of the nth string
Thank you for your help :)
Topic archived. No new replies allowed.