diff --git a/CPP/CPP.vcxproj b/CPP/CPP.vcxproj index 7e2be0a..10ff281 100644 --- a/CPP/CPP.vcxproj +++ b/CPP/CPP.vcxproj @@ -19,7 +19,10 @@ - + + + + 17.0 diff --git a/CPP/CPP.vcxproj.filters b/CPP/CPP.vcxproj.filters index 724a524..2d1758a 100644 --- a/CPP/CPP.vcxproj.filters +++ b/CPP/CPP.vcxproj.filters @@ -15,8 +15,13 @@ - + Fichiers sources + + + Fichiers de ressources + + \ No newline at end of file diff --git a/CPP/Source5.cpp b/CPP/Source5.cpp index 044cb8d..b1c1dad 100644 --- a/CPP/Source5.cpp +++ b/CPP/Source5.cpp @@ -13,10 +13,10 @@ int main(void) { system("cls"); printf_s("\t\t\tAffichage de la table ASCII\n"); for (int i = 15; i < 255; i++) { + printf_s("\t%c : %3i\t", char(i), i); if (i % 6 == 0) { printf_s("\n"); } - printf_s("\t%c : %c%i\t", char(i), i < 100 ? char(32) : char(0), i); } printf_s("\n\nAppuyez sur Echap pour quitter..."); } while (_getch() != 27); diff --git a/CPP/Source6.cpp b/CPP/Source6.cpp new file mode 100644 index 0000000..fa48f8d --- /dev/null +++ b/CPP/Source6.cpp @@ -0,0 +1,44 @@ +/* + * Programme d'affichage d'une moyenne de notes + * Par Florian Goussot + * BTS CIEL 2e année + * Fait le 05/11/2024 à Nancy +*/ +#include +#include +#include + +int main(void) { + do { + system("cls"); + printf_s("\t\t\tAffichage d'une moyenne de notes\n"); + printf_s("Donnez le nombre de notes : "); + double notes = 0, max = 0, min = 20; + int total_notes = 0; + scanf_s("%i", &total_notes); + for (int i = 1; i <= total_notes; i++) { + printf_s("Entrez une note :"); + float note = 0; + scanf_s("%f", ¬e); + if (note >= 0 && note <= 20) { + if (note > max) { + max = note; + } + if (note < min) { + min = note; + } + notes += note; + } + else { + i--; + printf_s("Veuillez entrer une note comprise entre 0 et 20 !\n\n"); + } + } + notes /= total_notes; + printf_s("La moyenne est de %.2f\n", notes); + printf_s("La note la plus basse est de %.2f\n", min); + printf_s("La note la plus élevée est de %.2f\n", max); + printf_s("\n\nAppuyez sur Echap pour quitter..."); + } while (_getch() != 27); + return 0; +} \ No newline at end of file diff --git a/CPP/Source7.cpp b/CPP/Source7.cpp new file mode 100644 index 0000000..4abc5aa --- /dev/null +++ b/CPP/Source7.cpp @@ -0,0 +1,42 @@ +/* + * Programme d'affichage d'une moyenne de notes + * Par Florian Goussot + * BTS CIEL 2e année + * Fait le 05/11/2024 à Nancy +*/ +#include +#include +#include + +int main(void) { + do { + system("cls"); + printf_s("\t\t\tAffichage d'une moyenne de notes\n"); + printf_s("Donnez le nombre de notes : "); + float notes[10]; + double max = 0, min = 20, moy = 0; + int total_notes = 0; + scanf_s("%i", &total_notes); + for (int i = 0; i <= total_notes - 1; i++) { + printf_s("Entrez une note :"); + scanf_s("%f", ¬es[i]); + if (notes[i] < min) { + min = notes[i]; + } + if (notes[i] > max) { + max = notes[i]; + } + } + printf_s("\nRécapitulatif des notes : "); + for (int j = 0; j <= total_notes - 1; j++) { + printf_s("%.2f\t", notes[j]); + moy += notes[j]; + } + moy /= total_notes; + printf_s("\nLa moyenne est de %.2f\n", moy); + printf_s("La note la plus basse est de %.2f\n", min); + printf_s("La note la plus élevée est de %.2f\n", max); + printf_s("\n\nAppuyez sur Echap pour quitter..."); + } while (_getch() != 27); + return 0; +} \ No newline at end of file diff --git a/CPP/Source8.cpp b/CPP/Source8.cpp new file mode 100644 index 0000000..1923aa3 --- /dev/null +++ b/CPP/Source8.cpp @@ -0,0 +1,33 @@ +/* + * Programme de calcul des nombres premiers + * Par Florian Goussot + * BTS CIEL 2e année + * Fait le 05/11/2024 à Nancy +*/ +#include +#include +#include + +int main(void) { + do { + system("cls"); + printf_s("\t\t\tProgramme de calcul des nombres premiers\n"); + printf_s("Donnez le nombre limite (>3) : "); + int nombres_premiers[100]; + int limite = 3; + scanf_s("%d", &limite); + for (int i = 0; i <= limite; i++) { + int nb_diviseurs = 0; + for (int j = 2; j <= i; j++) { + if (i % j == 1) { + nb_diviseurs++; + } + } + if (nb_diviseurs == 1) { + + } + } + printf_s("\n\nAppuyez sur Echap pour quitter..."); + } while (_getch() != 27); + return 0; +} \ No newline at end of file diff --git a/CPP/Template.txt b/CPP/Template.txt new file mode 100644 index 0000000..e6fa685 --- /dev/null +++ b/CPP/Template.txt @@ -0,0 +1,18 @@ +/* + * Titre du programme + * Par Florian Goussot + * BTS CIEL 2e année + * Fait le 05/11/2024 à Nancy +*/ +#include +#include +#include + +int main(void) { + do { + system("cls"); + printf_s("\t\t\tTitre du programme\n"); + printf_s("\n\nAppuyez sur Echap pour quitter..."); + } while (_getch() != 27); + return 0; +} \ No newline at end of file