-
Notifications
You must be signed in to change notification settings - Fork 0
/
paquete.h
65 lines (52 loc) · 1.3 KB
/
paquete.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef PAQUETE_H
#define PAQUETE_H
#include <iostream>
#include <iomanip>
using namespace std;
class Paquete
{
private:
string id;
string origen;
string destino;
float peso;
public:
Paquete();
string getId() const;
void setId(const string &value);
string getOrigen() const;
void setOrigen(const string &value);
string getDestino() const;
void setDestino(const string &value);
float getPeso() const;
void setPeso(float value);
//Sobrecarga del Operador
friend istream &operator >> (istream &in, Paquete &paq){
string var;
float peso;
cout<<"Ingrese id: ";
cin.ignore();
getline(cin,var); cout<<endl;
paq.setId(var);
cout<<"Origen: ";
getline(cin,var);cout<<endl;
paq.setOrigen(var);
cout<<"Destino: ";
cin.ignore();
getline(cin,var); cout<<endl;
paq.setDestino(var);
cout<<"Peso: ";
cin>>peso; cout<<endl;
paq.setPeso(peso);
cin.ignore();
return in;
}
friend ostream &operator <<(ostream &out, Paquete paq){
cout<<setw(10)<<paq.id;
cout<<setw(10)<<paq.origen;
cout<<setw(10)<<paq.destino;
cout<<setw(10)<<paq.peso<<endl;
return out;
}
};
#endif // PAQUETE_H