string lastNames(string name[],int SIZE){
  stringstream ss;
  for(int i = 0; i < SIZE; i++){
    ss << '"' << name[i].substr(0) << name[i].erase(name[i].find(',')) << '"' << " ";
    
  }  
  return ss.str();
}

this is outputting my list of names correctly other than all the names come out twice like "namename"
how can i stop this?

would't it be easier to use? :

string lastNames(std::list<string> name_list){
  stringstream ss;
  for(std::list<string>::const_iterator i = name_list.begin(); i != name_list.end(); i++){
    ss << '"' << i->substr(0) << i->erase(i->find(',')) << '"' << " ";
    
  }  
  return ss.str();
}

what exactly should come out, i need an example!

Don't worry about it i got it in the end, thanks though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.