Or you could use STL to do this for you applying the floor function on your vector and returning the result in another vector.

[CODE]

include <vector>
include <cmath>
include <algorithm>
include <functional>

int main()
{
typedef std::vector<double> Vec;
Vec first;
//Fill this vector with double values

Vec second(first.size());
std::pointer_to_unary_function <double, double> floorObject(std::floor);
std::transform(first.begin(), first.end(), second.begin(), floorObject);

return 0;

}

[/CODE]

mrnutty commented: Nice, didn't know about pointer_to_unary_function +13

As I said, I didn't try my code. Indeed I defined the operator<< inside the OrderTree class, and it then passes [I]this[/I] as the first parameter, which is not what I wanted. So here is another attempt... Tell me if that's working for you ?

main.cpp
[CODE]
//////////////////////////////////////////////////////////////
//////main.cpp///
/////////////////////////////////////////////////////////////
//////Author:xxxxxxxxxxxxxx
/////////////////////////////////////////////////////////////
//////Student number:xxxxxxxxx
/////////////////////////////////////////////////////////////
//////Date of creation:July 14,2011
/////////////////////////////////////////////////////////////

include "Tree.h"
include <iostream>
include <string>
include <fstream>
include <string>
include <sstream>

using namespace std;

using std::cout;
using std::cin;

OrderTree tree;
void load() //inserting words from a file into the tree.
{
string filename;
//the variable of type ifstream:
std::cout << "Please enter the desired filename with it's extension:\t ";
std::cin >> filename;

const char *file=filename.c_str();
std::ifstream myfile(file, std::ios::in);

if (!myfile.is_open())
{
    cout << "Can't open file\n";
}
else if (myfile.is_open())
{
    string line;

    // read one line at a time
    while (getline(myfile, line))
    {
        stringstream sstrm(line);
        std::string English;
        std::string Klingon;

        if(getline(sstrm, English,':'))
        {
            sstrm >> Klingon;
            cout <<English<<":"<< Klingon <<endl;
            // two words extracted
            tree.insert(Order(English, Klingon));
        }
    }
}

}
void insert() //inserting a word into the tree.
{
std::cout <<
"Insert a word into the tree\n"
"Enter a Word:\n <English> : <Klingon> ";
std::string English;
std::string Klingon;
std::cin >> English;
// std::cout << "";
std::cin >> Klingon;
tree.insert(Order(English, Klingon));

cout <<English<<":"<< Klingon <<endl;
}

void remove() //removing a word
{
std::cout << "Remove a word" << std::endl;
std::cout << "Enter word: ";
std::string English;
std::cin >> English;
std::cout << tree.remove(English) << std::endl;
}

void search() //searching for a ...

As you said, you need to put the whole tree in your file. So you need to traverse it and output that in your file. I assume you want the output to look similar to your print : <English>:<Spanish>.

In Order.h
[CODE]
std::ostream& operator<<(std::ostream &s, const Order &o) // print
{
s << o.English() << ":" << o.translation() << std::endl;
return s;
}
[/CODE]
In tree.h
[CODE]
class OrderTree
{
//private members of the class
private:

struct Node // bst as a reference structure made up of nodes
{
Node left;
Order data;
Node
right;
Node(): left(0), right(0) {}
Node &operator=(const Node &v)
{
left = v.left;
data = v.data;
right = v.right;
return *this;
}
};

std::ostream& operator<<(std::ostream& o, const Node* nod)
{
if (nod)
{
o << nod->left;
o << nod->data;
o << nod->right;
}
return o;
}

//Rest of the private code for OrderTree comes here

public:
const Node* getRoot() {return root;} //returns the root of the Tree

//Rest of the public code for OrderTree comes here

};

//And out of the OrderTree class definition
std::ostream& operator<<(std::ostream& o, const OrderTree& ordtree)
{
o << ordtree.getRoot();
return o;
}
[/CODE]
And in main.cpp
[CODE]
void up()
{
fstream file("example.txt", ios::out); //open for output
file << tree;
file.close();
}
[/CODE]
As I don't have your code, I can't test what I suggest. It's probably full of little mistakes, but you'll get the general idea. You need for each of your class/structs to define how to overload the operator<<.

Ok, in that case, would you please post your latest code (order.h, tree.h and main.cpp) ?

Would you please explain what's the goal of your project ? I understood it was some kind of dictionary, but now you're saying that the English word is actually an unsigned int ? That's confusing me.

First of all, your method is [ICODE]inOrderPrint_[/ICODE] but in the function up() you call [ICODE]tree.inOrderPrint()[/ICODE]

I would actually consider overloading the operators << and >> for the OrderTree class. So you could just write [ICODE]cout << tree;[/ICODE]

So you could define in your Tree.h header the following functions :
[CODE]
&istream operator<<(const OrderTree& tree, const istream& in)
{
//Have some way to go through your tree like DFS or BFS and for each data you do
in << tree.data << std::endl;

//After going through all your tree, just return the stream
return in;

}

&ostream operator>>(const OrderTree& tree, const ostream& out)
{
//Have some way to go through your tree like DFS or BFS and for each data you do
out >> tree.data >> std::endl;

//After going through all your tree, just return the stream
return out;

}
[/CODE]

Maybe if you would post the entire Tree.h, I could help a bit more...

In your load() code, I see a problem. You read a piece of a line with [ICODE]while (getline(myfile, line,':'))[/ICODE] because it stops at the first ':' it finds. Instead you should read the whole line, then make a stringstream and read until the ':'.

Here is another version which seems to work
[CODE]
void load() //inserting a word into the tree.
{
string filename;
//the variable of type ifstream:
std::cout << "Please enter the desired filename with it's extension:\t ";
std::cin >> filename;

const char *file=filename.c_str();
std::ifstream myfile(file, std::ios::in);

if (!myfile.is_open())
{
    cout << "Can't open file\n";
}
else if (myfile.is_open())
{
    string line;

    // read one line at a time
    while (getline(myfile, line))
    {
        stringstream sstrm(line);
        std::string English;
        std::string Spanish;

        if(getline(sstrm, English,':'))
        {
            sstrm >> Spanish;
            cout <<English<<":"<< Spanish <<endl;
            // two words extracted ...
            tree.insert(Order(English, Spanish));
        }
    }
}

}
[/CODE]

For your up() function, I don't know how your Tree.h is implemented and so how the function [ICODE]tree.inOrderPrint();[/ICODE] works.
I'm just puzzled by [ICODE]file.seekp(6, ios::beg); //move the put cursor to start of "text"[/ICODE]. What are you trying to achieve with this ?

With the inheritance you have, the base class has to be constructed before the derived class. Hence your second option is the right one.

Now I totally support Jonsca comment. A circle is not a point. So Circle shouldn't derive from Point. I would write
[CODE]
class circle
{
private:
int radius;
point p;
public:
circle(const point & p, int r);
int getRadius() const { return radius; } // Added const as this member funct doesn't change the Circle class.
const point & getCenter() const {return p;} // Added this other funct to get the center.
bool operator>(const circle & c); // Less time consuming to pass it by reference
};

circle::circle(point p, int r) : radius(r), p(p)
{
}

// The rest remains unchanged.
[/CODE]

For your point class, I would also make these small changes

[CODE]
class point
{
private:
int x, y;
public:
point() {} // Do you need this one ? I would make default parameters for the next constructor.
point(int x=0, int y=0);
point(const point& d); // Do you need this ? The default copy constructor will just do the same.
int getX() const { return x; } // Again some constness...
int getY() const { return y; }
};

point::point(int x=0, int y=0) : x(x), y(y)
{}
[/CODE]
When you write
[CODE]point::point(int x, int y) { this -> x = x; this -> y = y;}[/CODE]
This is wrong. All data members are initialized before entering the constructor. For built-in types there's no guarantee ...

[QUOTE=flasp;1452197]M8 the next chapter is about if statments... It have to be done with a do-while, while or for loop.. Without logical expression as &&.. !0=, ==, => things is fine, cause its in the chapter with the assignment... Thanks for the help though...[/QUOTE]
And do...while is what you should use, as I wrote below my code. The code was just given as an example which shows something that will not work.

So basically you will use a
[code]
do
{
// Insert the code you want to repeat until 0 is entered
}while(numbers != 0)
[/code]
So this do...while will be wrapped around the largest part of your code, repeating it as long as the user doesn't enter 0.

You might find this interesting : [URL="

[QUOTE=flasp;1451454]The assignment says "Write a program that asks the user to type in numbers. After each entry, the program should report the cumulative sum of the entries to date. The program should terminate when the user enters 0."

I have partly been succesfull I guess. But I dont know how to make the program so it doesnt quit when I press the first number. And for it to actually quit when I press 0.. I hope a friendly soul can help me out.[/QUOTE]
You might want to decompose the problem in small sub-problems. So reading this assignment, you find out that you are required to do a few things :
[LIST]
[]get a number from the user
[
]compute a cumulative sum
[*]terminate the program when the user enters 0
[/LIST]
You already achieved the first point with the usage of std::cin >> numbers. (and I'll make a note for myself to make sure the user entered a number. What would happen if the user entered a character ? But that's something you'll worry about afterwards).

For the second point, it seems you will need another variable to hold your running sum. Probably an int.

The third item is the one you're struggling with. So let's try to decompose it into even smaller problems. How do you terminate a program ? There are a few ways to do it, but it should normally terminate when you [I]return[/I] from your main function. And how do you return from your main function, well ...

jonsca commented: Nice explanation. Thanks for not giving the OP the answer. :) +6