First commit
This commit is contained in:
18
IUT/Info1/DS/Correction DS.txt
Normal file
18
IUT/Info1/DS/Correction DS.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
============================= Brouillon =============================
|
||||
|
||||
F de R dans R : Tracé courbe
|
||||
Angles en radians
|
||||
|
||||
0) Verification des limites
|
||||
Saisie_plusgrand(1 réel) -> 1 réel
|
||||
Plus petit < plus grand
|
||||
1) Repere(x, y, a, b) # Angles en degrés
|
||||
Demande de nb_points
|
||||
2) Trace(z, z')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
30
IUT/Info1/DS/main.cpp
Normal file
30
IUT/Info1/DS/main.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "trace.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
float xmin, xmax, ymin, ymax, x, y;
|
||||
float rad;
|
||||
unsigned int nb_points, i;
|
||||
|
||||
cout << "Saisir" << endl;
|
||||
cin >> xmin >> ymin;
|
||||
|
||||
xmax = Saisie_plusgrand(xmin);
|
||||
ymax = Saisie_plusgrand(ymin);
|
||||
|
||||
cout << "Saisir" << endl;
|
||||
cin >> nb_points;
|
||||
|
||||
// Repere(...)
|
||||
|
||||
for (i = 0; i < nb_points; i++) {
|
||||
rad = Deg2rad(x);
|
||||
y = f(rad);
|
||||
Trace(x, y);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
31
IUT/Info1/DS/trace.cpp
Normal file
31
IUT/Info1/DS/trace.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "trace.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
float Saisie_plusgrand(float min) {
|
||||
float max;
|
||||
|
||||
do {
|
||||
cout << "Saisir";
|
||||
cin >> max;
|
||||
} while (max <= min);
|
||||
|
||||
return max;
|
||||
}
|
||||
|
||||
float f(float x) {
|
||||
float y;
|
||||
const float PI = 3.141565358979;
|
||||
|
||||
if (x < 0) {
|
||||
y = ((float)3/7) * (cos(x) - 1);
|
||||
} else if (x <= 2*PI) {
|
||||
y = sin(x) * 2;
|
||||
} else {
|
||||
y = sin(3*x)/3;
|
||||
}
|
||||
|
||||
return y;
|
||||
}
|
||||
10
IUT/Info1/DS/trace.h
Normal file
10
IUT/Info1/DS/trace.h
Normal file
@@ -0,0 +1,10 @@
|
||||
void Repere(float xmin, float xmax, float ymin, float ymax);
|
||||
|
||||
void Trace(float x, float y);
|
||||
|
||||
float f(float x);
|
||||
|
||||
float Saisie_plusgrand(float max);
|
||||
|
||||
// RES
|
||||
float Deg2rad(float deg);
|
||||
Reference in New Issue
Block a user