#include <iostream>
#include <ctime>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <algorithm>
using namespace std;
class letter{
private:
int genre;
int price;
string adress;
public:
letter();
~letter();
};
class parcel{
private:
int genre;
int price;
string adress;
public:
parcel();
~parcel();
};
class post{
private:
letter** LETTERS;
parcel** PARCELS;
int number_of_letters;
int number_of_parcels;
int sort_parcels();
int sort_letters();
public:
post();
~post();
};
//In the constructor of letter it gets genre-price-adress
//In the constructor of parcel it gets genre-price-adress
int post::sort_parcels(){
//how do i use sort here?
}
int post::sort_letters(){
//how do i use sort here?
}
post::post(){
number_of_letters=rand()%50;
number_of_parcels=rand()%50;
LETTERS=new letter*[number_of_letters];
for(int i=0;i<number_of_letters;i++){
LETTERS[i]=new letter;}
PARCELS=new parcel*[number_of_parcels];
for(int i=0;i<number_of_parcels;i++){
PARCELS[i]=new parcel;}
//Here i want to sort LETTERS and PARCELS regarding their adress
//Would it be easier if i used vectors of parcel-letter instead of pointer-to-pointer ?
Can u answer to my questions marked as // in the code segment?
I am a newbie and i dont know well how while we are in a class we get sth from the other class.
Thx in advance....