You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.8 KiB
57 lines
1.8 KiB
#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";
|
|
|
|
}
|
|
}
|