I am very new to programing in general!
so I'm building a program that simply takes information about a user and stores it in a object. So each time a new user comes along I will need a new object with a new name (this is just a program I'm building to practice). I know I have too allocate space on the heap, but how do I know how much space I will need if I don't know how many objects I want to net? I think what I need to do is allocate memory on the heap with in the function that creates the obj so each time the function is called I get the required memory? I read something where someone suggested using vectors so I brief learned a intro about those but when I try this
string objname;
cin >> objname;
vector<string> v;
v.push_back(objname);
usersclass v.back();
v.back().somefunc();
An error occurs which I honestly didn't think it would be any different from:
string objname;
cin >> objname;
usersclass objname;
objname.somefunc();
Please give me a example this isn't for school or anything I'm teaching myself.