-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModelo.h
61 lines (56 loc) · 921 Bytes
/
Modelo.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
#include <iostream>
#include <stdlib.h>
#include <conio.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;
template <class T>
class Suma {
private:
T n1;
T n2;
public:
Suma(T, T);
T sumaNumeros();
T restaNumeros();
T divisionNumeros();
T multiplicacionNumeros();
T potenciaNumeros();
T getN1() { return n1; }
T getN2() { return n2; }
void setN1(T _n1) { n1 = _n1; }
void setN2(T _n2) { n2 = _n2; }
};
template <class T>
Suma<T>::Suma(T _t1, T _t2)
{
n1 = _t1;
n2 = _t2;
}
template <class T>
T Suma<T>::sumaNumeros() {
return n1 + n2;
}
template <class T>
T Suma<T>::restaNumeros(){
return n1-n2;
}
template <class T>
T Suma<T>::divisionNumeros(){
if (n2==0){
return n2/n1;
}
else
{
return n1/n2;
}
}
template <class T>
T Suma<T>::multiplicacionNumeros() {
return n1 * n2;
}
template <class T>
T Suma<T>::potenciaNumeros() {
return pow(n1,n2);
}