parent
adf63f044e
commit
e1b7fc2b8f
@ -0,0 +1,28 @@
|
||||
{
|
||||
"tasks": [
|
||||
{
|
||||
"type": "cppbuild",
|
||||
"label": "C/C++: gcc générer le fichier actif",
|
||||
"command": "/usr/bin/gcc",
|
||||
"args": [
|
||||
"-fdiagnostics-color=always",
|
||||
"-g",
|
||||
"${file}",
|
||||
"-o",
|
||||
"${fileDirname}/${fileBasenameNoExtension}"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${fileDirname}"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"detail": "Tâche générée par le débogueur."
|
||||
}
|
||||
],
|
||||
"version": "2.0.0"
|
||||
}
|
Binary file not shown.
@ -0,0 +1,56 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
// Ouverture du fichier en mode écriture
|
||||
FILE* f = fopen("resultats.txt", "w");
|
||||
if (f == NULL) {
|
||||
printf("Error opening file!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Initialisation du générateur de nombres aléatoires
|
||||
srand(time(0));
|
||||
|
||||
// Écriture des en-têtes de colonnes
|
||||
fprintf(f, "Numero de candidat\tNom\tPrenom\tNote de maths\tNote de francais\tNote d'anglais\tNote de specialite\tNombre de choix de candidatures\tVille choisie de la premiere candidature\tDepartement\tDecision du departement\tValidation\n");
|
||||
|
||||
// Génération de données aléatoires pour chaque candidat
|
||||
for (int i = 1; i <= 100; i++) {
|
||||
char nom[21];
|
||||
for (int j = 0; j < 20; j++) {
|
||||
nom[j] = rand() % 26 + 'a';
|
||||
}
|
||||
nom[0] = toupper(nom[0]);
|
||||
char prenom[21];
|
||||
for (int j = 0; j < 20; j++) {
|
||||
prenom[j] = rand() % 26 + 'a';
|
||||
}
|
||||
char note_maths[3];
|
||||
sprintf(note_maths, "%d", rand() % 21);
|
||||
char note_francais[3];
|
||||
sprintf(note_francais, "%d", rand() % 21);
|
||||
char note_anglais[3];
|
||||
sprintf(note_anglais, "%d", rand() % 21);
|
||||
char note_specialite[3];
|
||||
sprintf(note_specialite, "%d", rand() % 21);
|
||||
char nb_choix[2];
|
||||
sprintf(nb_choix, "%d", rand() % 6);
|
||||
char ville[] = "Clermont-Ferrand";
|
||||
char departement1[14];
|
||||
sprintf(departement1, "Departement%d", rand() % 21);
|
||||
char departement2[14];
|
||||
sprintf(departement2, "Departement%d", rand() % 21);
|
||||
char departement3[14];
|
||||
sprintf(departement3, "Departement%d", rand() % 21);
|
||||
char departement4[14];
|
||||
sprintf(departement4, "Departement%d", rand() % 21);
|
||||
char departement5[14];
|
||||
sprintf(departement5, "Departement%d", rand() % 21);
|
||||
char decision[] = "0";
|
||||
char validation[] = "0";
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
Numero de candidat Nom Prenom Note de maths Note de francais Note d'anglais Note de specialite Nombre de choix de candidatures Ville choisie de la premiere candidature Departement Decision du departement Validation
|
Loading…
Reference in new issue