-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fret.cpp
93 lines (69 loc) · 2.37 KB
/
Fret.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
#include <iostream>
#include <cmath>
#include <iomanip>
//#include <windows.h>
using namespace std;
//CliFret 0.1.1 CC BY-NC-SA 4.0
//resoudre le problme d'accent
//enregistrer sur github et mettre un liens dans le code
//interface graphique plus joli
//ajouter une icone (https://www.iconarchive.com/download/i125408/pictogrammers/material/guitar-electric.ico)
float siToImp(float a) {
return a / 25.4;
}
float impToSI(float b) {
return b * 25.4;
}
float roundDot(float d, int pres) {
return floor(d * pow(10, pres) + 0.5) / pow(10, pres);
}
int main() {
system("Color 09");
cout << fixed;
float lenthGiven, lenthSI, lenthImp, fretXSI;
int numberFret;
bool siOverImp;
wcout << "Bonjour,preferes-tu utiliser des mm ou inche ? (mm = 1, inch = 0)" << endl;
cin >> siOverImp;
wcout << "Quelle est le diapason de la corde (distance entre sillet et chevalet)(en ";
if (siOverImp == 1) { cout << "mm)"; }
else { cout << "inch)"; }
cout << endl;
cin >> lenthGiven;
wcout << "Combien de frettes a calculer ?" << endl;
cin >> numberFret;
for (int i = 1; i <= 2; i++) {
cout << endl;
}
wcout << "CliFret © 2023 by Chloe CHATEAU@Polytech-Saclay is licensed under CC BY-NC-SA 4.0" << endl;
wcout << "Sur une idee de Nathan BECKER@Lycee-Fernand-Leger" << endl;
wcout << "" << endl;
wcout << "https://github.com/Chlov48/CliFret for update and source-code" << endl;
for (int i = 1; i <= 2; i++) {
cout << endl;
}
if (siOverImp == true) {
lenthSI = lenthGiven;
}
if (siOverImp == false) {
lenthSI = impToSI(lenthGiven);
lenthImp = lenthGiven;
}
cout << "N mm inch" << endl;
//cout << "━━━━━━━━━━━┳━━━━━━" << endl;
cout << "------------------" << endl;
for (float i = 1; i <= numberFret; i++) {
fretXSI = lenthSI - (lenthSI * pow(2.0, (-i / 12)));
cout << setprecision(0) << i;
if (i < 10) { cout << " "; }
cout << " : ";
cout << setprecision(1) << roundDot(fretXSI, 1);
if (roundDot(fretXSI, 1) < 100) { cout << " "; }
//cout << " ┃ ";
cout << " | ";
cout << setprecision(2) << roundDot(siToImp(fretXSI), 2) << endl;
}
if (numberFret > 100) { wcout << "tu te fous de ma gueule ?"; }
system("pause");
return 0;
}