PDA

View Full Version : miniVector help needed


surreal5335
07-02-2010, 07:24 AM
I am working on an assignment for class requiring me to use miniVectors and my book is explaining very little about how to set it up properly. I am also having a very hard time finding a tutorial at all online about miniVectors.

So far I have written a program which is delivering a pile of errors I dont have a clue to fix bc my book doesnt really say much and the net thinks I am talking about a mini from France.

So for a start, I am asking about how to properly set up a miniVector:

I have:


void writeMiniVector(const miniVector<T>& v);
void sortMiniVector(miniVector<T>& v);

int vSize = size();


obviously these are my prototypes.

The compiler tells me that:


'T' was not declared in this scope
template argument 1 is invalid
ISO C++ forbids declaration of v with no type
size was declared in this scope


I have included my vector.h file as so:

#include "d_vector.h"

Any suggestions or referals to an in depth article on miniVectors would be much appreciated.

Thanks in advance

Archeleus
07-02-2010, 09:46 AM
Well, I haven't ever heard that C++ had miniVectors before, but anyway you can read <a href="http://www.bgsu.edu/departments/compsci/docs/templates.html">here</a> about template classes.

Hopefully you will be able to google for more information.

Cheers.

surreal5335
07-02-2010, 10:00 AM
Thanks for the reply, the sad thing is the only site that made a solid reference to miniVectors was the site selling the book I have... If this is such an unknown term on the net regarding c++ why, oh why, do we have to spend a week learning it? If its not mentioned on the internet, it must not be used basically at all in the real world. This week is a waste of my time. Sorry, just agrivates me to spend all this money and time and put it towards pointless topics.

I welcome anymore suggestions

Archeleus
07-02-2010, 10:58 AM
Well I am not at home at the moment, and I'll try some stuff with it when I'm back at my house.

Always a pleasure to look through new stuff.

EDIT : Check here :
http://www.brainmass.com/homework-help/computer-science/data-structures-algorithms/309752

oracleguy
07-02-2010, 03:31 PM
Thanks for the reply, the sad thing is the only site that made a solid reference to miniVectors was the site selling the book I have... If this is such an unknown term on the net regarding c++ why, oh why, do we have to spend a week learning it? If its not mentioned on the internet, it must not be used basically at all in the real world. This week is a waste of my time. Sorry, just agrivates me to spend all this money and time and put it towards pointless topics.

That miniVectors is just a custom object your book made, that is why you cannot find that much information on it. If it is designed to demonstrate and teach you how vectors work, it isn't pointless. There is a vector class in the STL, std::vector.

They probably made their own vector class to make it easier for someone new to C++ to understand what is going on.

surreal5335
07-02-2010, 09:37 PM
Thanks for pointing that out, that makes a lot of sense. I think I will just build the program using vectors. The teacher is pretty flexible, seems more concerned with getting it working.