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 :)
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