-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.cpp
128 lines (96 loc) · 2.56 KB
/
test.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// Your First C++ Program
#include <cmath>
// calcolo integrale
#include "Calcolo Numerico/integralCalculator.cpp"
#include "Calcolo Numerico/equationSolver.cpp"
// calcolo zeri funzione
#include "Calcolo Numerico/zeroFinder.cpp"
// classe albero binario
#include "Strutture Dati/Tree.cpp"
// algoritmi di ordinamento
#include "sorting.cpp"
// operazioni binarie
#include "Calcolo Numerico/binaryOperations.cpp"
// input output
#include <iostream>
using namespace std;
//
const int HEIGHT = 5;
const int WIDTH = 10;
int jimmy[HEIGHT][WIDTH];
int n = 10;
double square(double v)
{
return v * v - 5;
}
double cube(double v)
{
return v * v * v - 10;
}
// arrays are passed by reference
void arrayChange(int array[10])
{
for (int i = 0; i < 10; i++)
{
array[i] = 7;
}
}
void changePointer(int* p) {
int a = 100;
// perchè questo funziona?
*p = a;
// e questo no?
p = &a;
}
int main()
{
/*
int a[] = {0,0,0,0,0,0,1,1};
int b[] = {0,0,0,0,0,0,0,1};
binaryAdd(a,b, 8); */
/* solutions equation = solveEquation2(1,0,1);
cout << equation.found;
cout << equation.s1 << " " << equation.s2 ; */
// TEST ORDINAMENTO
/* int l = 10;
int array[l];
randFill(array,l,100);
selectionSort(array, l);
int* n = bubbleSort(array,l); */
// printArray(array,l);
// array di zeri
/* int a[10] = {};
printArray(a,10); */
// TEST PUNTATORI
/* int p = 10;
int* pointer = &p;
// (by value, shouldn't change the actual pointer. but it changes if i called the other two functions before )
cout << *pointer << endl;
// (by value, shouldn't change the actual pointer. but it changes if i called the other two functions before )
changePointer(pointer);
cout << *pointer << endl; */
// stampa 75 100 100
// TEST CALCOLO INTEGRALE
double b = integralCalculator(square, -5,5,100);
double c = integralCalculatorT(square, -5,5, 100);
double d = newtonRaphson(square, -5,5, 100);
cout << "VALUE"+std::to_string(b) << endl;
cout << "VALUE"+std::to_string(c) << endl;
cout << "VALUE"+std::to_string(d) << endl;
// TEST APPROSSIMAZIONE ZERI
/* double zero = recursiveZeroFinder(square, -100,100,1000); */
/* zero = zeroFinder(square, -100,100, 100); */
/* double zero = regulaFalsi(square, -5.0, 0.0, 10);
cout << zero << endl; */
// TEST ALBERO DI RICERCA BINARIO
/* Tree tree = Tree();
for (int i = 0; i < 10; i++)
{
int r = rand() % 1000;
tree.insert(r);
}
tree.inOrder(tree.head);
tree.clean(tree.head);
*/
return 0;
}