I'm really trying to get all the pieces together, but this really confuses me.
What I want to accomplish:
I want a class to build objects and then store them in a vector. Then I'm going to create a meny to be able to add the objects from the consol, change the objects, search and list my created objects.
I guess it's not to complicated, but I really don't get it. I know how to create a class and use it to build an object, but only in the sourcecode. I don't know how to build new objects from user input in the consol.
Vectors, pointers and iterators are really something I do not get. I've read all about it, but still don't know how to use it.
I'm not expecting anyone to create this for me, but I would really appreciate if someone could explain to me how to make it myself.
I'm at this stage in my knowlage:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
#include <iostream>
using namespace std;
class Example
{
public:
//This is where I'm supposed to create a blueprint for my objects
//of the class Example.
// Is this where the user input is supposed to take place?
}
int main()
{
// Where is the vector supposed to be declared?
do
{
// My meny
}
while();
}
|
I know how to create the meny and make it work with a switch depending on the users input. And the do-while loop is just an example, I know how to work it.
The meny choices calls functions, and one of this functions is supposed to create an object of the class Example and store it in the vector. I do not know how to create this function.
An other meny choice is supposed to let the user change data in a stored object. I have no idea of how to make this happen.
And least I want a search function to search for objects based on user input. And offcourse a list option to list all the objects in the vector.
Please don't leave me half-baked. I really want to learn how to do this.
This must be the longest post I've ever posted on this forum. Any help in any way is appreciated.
Thanks