First commit
This commit is contained in:
BIN
IUT/Info1/TD/Exercices/exam1/Synthese_exam.pdf
Normal file
BIN
IUT/Info1/TD/Exercices/exam1/Synthese_exam.pdf
Normal file
Binary file not shown.
57
IUT/Info1/TD/Exercices/exam1/fonction.cpp
Normal file
57
IUT/Info1/TD/Exercices/exam1/fonction.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "fonction.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
// int saisiePromo(
|
||||
// struct Etudiant promo[],
|
||||
// unsigned int taille_relle)
|
||||
// {
|
||||
// unsigned int i = 0;
|
||||
|
||||
// do
|
||||
// {
|
||||
// char nom[21];
|
||||
// char prenom[21];
|
||||
// float moyenne_generale;
|
||||
// unsigned int scolarisation;
|
||||
|
||||
// cout << "Saisissez le nom de l'étudiant" << endl;
|
||||
// cin >> nom;
|
||||
// cout << "Saisissez le prenom de l'étudiant" << endl;
|
||||
// cin >> prenom;
|
||||
// cout << "Saisissez la moyenne de l'étudiant" << endl;
|
||||
// cin >> moyenne_generale;
|
||||
// cout << "Saisissez la scolarisation de l'étudiant" << endl;
|
||||
// cin >> scolarisation;
|
||||
|
||||
// if (
|
||||
// moyenne_generale >= 0 and moyenne_generale <= 20
|
||||
// and scolarisation <= 1
|
||||
// ) {
|
||||
// promo[i] = {nom, prenom, moyenne_generale, scolarisation};
|
||||
// i++;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return i+1;
|
||||
// }
|
||||
|
||||
unsigned int filtreDemission(
|
||||
struct Etudiant promo[],
|
||||
const unsigned int taille_pratique
|
||||
) {
|
||||
unsigned int decompte = taille_pratique;
|
||||
struct Etudiant temporaire;
|
||||
|
||||
// Tri par selection...
|
||||
for (unsigned int j = 0; j < taille_pratique-1; j++) {
|
||||
for (unsigned int i = 0; i < taille_pratique-1; i++)
|
||||
if (promo[i].scolarisation == 0) {
|
||||
temporaire = promo[i];
|
||||
promo[i] = promo[i+1];
|
||||
promo[i+1] = temporaire;
|
||||
}
|
||||
}
|
||||
}
|
||||
34
IUT/Info1/TD/Exercices/exam1/fonction.h
Normal file
34
IUT/Info1/TD/Exercices/exam1/fonction.h
Normal file
@@ -0,0 +1,34 @@
|
||||
struct Etudiant {
|
||||
char nom[21];
|
||||
char prenom[21];
|
||||
float moyenne_generale;
|
||||
unsigned int scolarisation; // 1 pour scolarisé, 0 pour déscolarisé
|
||||
};
|
||||
|
||||
struct Node {
|
||||
struct Etudiant racine;
|
||||
struct Node gauche;
|
||||
struct Node droit;
|
||||
}
|
||||
|
||||
unsigned int heapsortPromo(
|
||||
struct Etudiant promo[],
|
||||
unsigned int taille_pratique
|
||||
);
|
||||
|
||||
unsigned int saisiePromo(
|
||||
struct Etudiant promo[],
|
||||
unsigned int taille_relle
|
||||
);
|
||||
|
||||
unsigned int filtreDemission(
|
||||
struct Etudiant promo[],
|
||||
unsigned int taille_pratique
|
||||
);
|
||||
|
||||
float moyenne(
|
||||
struct Etudiant promo[],
|
||||
unsigned int taille_pratique
|
||||
);
|
||||
|
||||
|
||||
21
IUT/Info1/TD/Exercices/exam1/main.cpp
Normal file
21
IUT/Info1/TD/Exercices/exam1/main.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "fonction.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
unsigned int nb_etu_initial;
|
||||
unsigned int nb_etu_jury;
|
||||
float moyenne_promo;
|
||||
|
||||
nb_etu_initial = saisiePromo();
|
||||
|
||||
nb_etu_jury = filtreDemission();
|
||||
|
||||
moyenne_promo = moyenne();
|
||||
|
||||
cout << "La moyenne de promotion est de : " << moyenne_promo << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
18
IUT/Info1/TD/Exercices/exam1/test.py
Normal file
18
IUT/Info1/TD/Exercices/exam1/test.py
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
|
||||
def tri_selection(tab):
|
||||
for _ in range(len(tab) - 1):
|
||||
for j in range(len(tab)-1):
|
||||
if tab[j] == 0:
|
||||
temp = tab[j]
|
||||
tab[j] = tab[j+1]
|
||||
tab[j+1] = temp
|
||||
return tab
|
||||
|
||||
liste = [0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0]
|
||||
|
||||
tri1 = tri_selection(liste)
|
||||
|
||||
print(liste)
|
||||
print(tri1)
|
||||
Reference in New Issue
Block a user