Please bear with me. This is my first post.
For some reason, I can only display the strings if I put the cout in the same loop. But since I have to separate addString() and displayAllStrings(), I can't do that. My displayAllStrings() keeps failing.
BUT when I write a separate display method, nothing is displayed.
Sometimes when I try editing that part of the code, I end up with 'subscript out of range' errors.
void Class::addString(vector<string>database, vector<string>newItem)
{
for(int r=0;r<9;r++)
{
database.push_back(newItem[r]);
//cout<<"\n"<<r<<": "<<database[r]<<"\n"; //This can display
}
void Class::displayAllStrings()
{
for(int t=0; t<database.size(); t++)
{
cout<<"\n"<<t<<": "<<database[t]<<"\n";
}
}
class Class
{
private:
//last name, first name, street address, city, country, postal code, home phone number, mobile phone number, email address
vector<string>database;
public:
database();
void displayAllStrings();
void addString(vector<string> database,vector<string> newItem);
};