-
Notifications
You must be signed in to change notification settings - Fork 0
/
murtolukuMain.cpp
52 lines (41 loc) · 1.29 KB
/
murtolukuMain.cpp
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
#include <iostream>
#include "murtoluku.h"
using namespace std;
using otecpp_murtoluku::Murtoluku;
int main(int argc, char *argv[]) {
Murtoluku ml_a(12,5);
Murtoluku ml_b(0,1);
Murtoluku ml_c(12,-15);
Murtoluku ml_d(-3,0);
std::cout << ml_a / ml_b << std::endl;
std::cout << ml_c / ml_d << std::endl;
std::cout << ml_d / ml_c << std::endl;
/*std::cout << ml_b << std::endl;
std::cout << ml_c << std::endl;
std::cout << ml_d << std::endl;
*/
/* --- */
Murtoluku mlt[6] = {Murtoluku(3, 9), Murtoluku(2, -10), Murtoluku(0, 4),
Murtoluku(-2, 0), Murtoluku(), Murtoluku(5)};
cout << "Luvut:";
for(int i = 0; i < 6; ++i)
{
cout << " " << mlt[i];
}
cout << endl;
for(int i = 1; i < 4; ++i)
{
cout << mlt[i-1] << " + " << mlt[i] << " = " << mlt[i-1] + mlt[i] << '\n';
cout << mlt[i-1] << " - " << mlt[i] << " = " << mlt[i-1] - mlt[i] << '\n';
cout << mlt[i-1] << " * " << mlt[i] << " = " << mlt[i-1] * mlt[i] << '\n';
cout << mlt[i-1] << " / " << mlt[i] << " = " << mlt[i-1] / mlt[i] << '\n';
}
cout << mlt[0] << "++ = ";
cout << mlt[0]++ << '\n';
cout << mlt[0] << "-- = ";
cout << mlt[0]-- << '\n';
cout << "++" << mlt[0] << " = ";
cout << ++mlt[0] << '\n';
cout << "--" << mlt[0] << " = ";
cout << --mlt[0] << '\n';
}