I am making a program (new to c++) which lets you save contacts and then allow you to list them and remove them. I am lost to how I would number each contact, for example:
1. Sam 21340223
2. Jessica 21020303

Recommended Answers

All 6 Replies

In my knowledge, I might use Linked List :D, but I'm meeting with some problem in pointer know :(
so you should search Linked List for your purpose :D

ahh.. is that using nodes??

yes :) and if you want to search/delete/add with fast speed, you should use some data structure for this work. (example: Skipped List, Heap,etc...)

check out std::list.

See this fast constructed code snippet below:

#include <list>
#include <string>

class Person
  Person(std::string name, std::string number);
  std::string _name;
  std::string _number;

int main(void)
  std::list<Person> myListOfPersons;

  Person p1("Sam","21340223");

  Person p2("Jessica","21020303");


  return 0;
Be a part of the DaniWeb community

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