What does "->" do for vectors?

And, how do you use the vector algorithms?

And, also, when/why do you use #ifndef something_H, #define something_H, ..., #endif?

Is there a difference between "vector" and "apvector"?

Is there any specific piece of code you are looking at that is peaking your interest.. causing you to ask these questions? If so, please show us. It will help us to explain it to you if we actually have something to look at.

Is there any specific piece of code you are looking at that is peaking your interest.. causing you to ask these questions? If so, please show us. It will help us to explain it to you if we actually have something to look at.

For the ->'s

Employee::Employee(string firstName, string lastName, int skillLevel, int benefitCode, int contribution, int hoursWorked, int id)
{
	this->firstName = firstName;
	this->lastName = lastName;
	this->skillLevel = skillLevel;
	this->benefitCode = benefitCode;
	this->contribution = contribution;
	this->hoursWorked = hoursWorked;
	this->id = id;
}

Algorithms: How would you use max_element, search, sort, and/or swap?

For the last two question, those are just general questions (no code)?

X->membervariable is a shortcut for (*X).membervariable (so it can access a member of a class or struct to which you have a pointer.
See "this" (no pun intended) for an explanation of that particular case you cited.

Here's a good reference for the vector algorithms (it has miniprograms with each to give you some good examples)

And, also, when/why do you use #ifndef something_H, #define something_H, ..., #endif?
If you have a project with a large number of files and any given file will include multiple headers, there exists the possibility of ending up two files being incorporated with the same header, which can cause problems. So the compiler looks and sees if that symbol SOMETHING_H (could be anything really, people just usually capitalize the name of the header with an underscore) is already defined. If it isn't then it will go ahead and define it and everything after it (the contents of the header). If it is already defined, it will skip to the #endif and the header contents will not be included.

AFAIK, apvector was created by the college board to make the lives of AP Computer Science students easier. It's basically an array with a built in length member, bounds checking, and a few (definitely not as many as the STL Vector) member functions.

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.