First commit
This commit is contained in:
28
IUT/Info1/TD/Exercices/5.3_surface_cyl/.vscode/tasks.json
vendored
Normal file
28
IUT/Info1/TD/Exercices/5.3_surface_cyl/.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"tasks": [
|
||||
{
|
||||
"type": "cppbuild",
|
||||
"label": "C/C++: g++ build active file",
|
||||
"command": "/usr/bin/g++",
|
||||
"args": [
|
||||
"-fdiagnostics-color=always",
|
||||
"-g",
|
||||
"*.cpp",
|
||||
"-o",
|
||||
"${fileDirname}/${fileBasenameNoExtension}"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${fileDirname}"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"detail": "Task generated by Debugger."
|
||||
}
|
||||
],
|
||||
"version": "2.0.0"
|
||||
}
|
||||
17
IUT/Info1/TD/Exercices/5.3_surface_cyl/calculation.cpp
Normal file
17
IUT/Info1/TD/Exercices/5.3_surface_cyl/calculation.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "functions.h"
|
||||
|
||||
float PI = 3.141592;
|
||||
|
||||
float Perimetre(float rayon) {
|
||||
float perimetre;
|
||||
|
||||
perimetre = PI * rayon * 2;
|
||||
return perimetre;
|
||||
}
|
||||
|
||||
float Surface(float rayon) {
|
||||
float surface;
|
||||
|
||||
surface = PI * rayon * rayon;
|
||||
return surface;
|
||||
}
|
||||
10
IUT/Info1/TD/Exercices/5.3_surface_cyl/functions.h
Normal file
10
IUT/Info1/TD/Exercices/5.3_surface_cyl/functions.h
Normal file
@@ -0,0 +1,10 @@
|
||||
// Fonctions d'Affichage
|
||||
void Presentation(void);
|
||||
void afficherResultats(float, float);
|
||||
|
||||
// Fonction de Saisie
|
||||
float saisieRayon(void);
|
||||
|
||||
// Fonctions de Calcul
|
||||
float Perimetre(float);
|
||||
float Surface(float);
|
||||
20
IUT/Info1/TD/Exercices/5.3_surface_cyl/io.cpp
Normal file
20
IUT/Info1/TD/Exercices/5.3_surface_cyl/io.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <iostream>
|
||||
#include "functions.h"
|
||||
using namespace std;
|
||||
|
||||
void Presentation() {
|
||||
cout << "Cet algortihme calcule le périmètre et la surface d'un disque de rayon saisi" << endl;
|
||||
}
|
||||
|
||||
void afficherResultats(float perimetre, float surface) {
|
||||
cout << "Perimètre : " << perimetre << "u.a." << endl;
|
||||
cout << "Surface : " << surface << "u.a.²" << endl;
|
||||
}
|
||||
|
||||
float saisieRayon() {
|
||||
float rayon;
|
||||
|
||||
cout << "Saisir une rayon" << endl;
|
||||
cin >> rayon;
|
||||
return rayon;
|
||||
}
|
||||
BIN
IUT/Info1/TD/Exercices/5.3_surface_cyl/main
Normal file
BIN
IUT/Info1/TD/Exercices/5.3_surface_cyl/main
Normal file
Binary file not shown.
17
IUT/Info1/TD/Exercices/5.3_surface_cyl/main.cpp
Normal file
17
IUT/Info1/TD/Exercices/5.3_surface_cyl/main.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "functions.h"
|
||||
|
||||
int main() {
|
||||
float rayon;
|
||||
float perimetre;
|
||||
float surface;
|
||||
|
||||
Presentation();
|
||||
|
||||
rayon = saisieRayon();
|
||||
perimetre = Perimetre(rayon);
|
||||
surface = Surface(rayon);
|
||||
|
||||
afficherResultats(perimetre, surface);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user