This commit is contained in:
2023-10-23 13:23:36 +02:00
parent 667dae6f1a
commit 322b22f9bf
5711 changed files with 72953 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
#include<stdlib.h>
#include<stdio.h>
int main(void){
int place;
char nom[10][4];
int score[10];
FILE* hallOfFame = fopen("top10","r");
if (hallOfFame){
for (place=0;place<10;place++){
fread(&score[place],sizeof(int),1,hallOfFame);
printf("%09d ",score[place]);
fread(&nom[place],sizeof(char),3,hallOfFame);
nom[place][3]='\0';
printf("%s\n",nom[place]);
}
fclose(hallOfFame);
}
else{
printf("c'est toi qui est null\n");
}
return 0;
}

View File

@@ -0,0 +1,22 @@
#include<stdlib.h>
#include<stdio.h>
int main(void){
int place;
char nom[10][4];
int score[10];
FILE* hallOfFame = fopen("top10","r");
if (hallOfFame){
for (place=0;place<10;place++){
fread(&score[place],sizeof(int),1,hallOfFame);
printf("%09d ",score[place]);
fread(&nom[place],sizeof(char),3,hallOfFame);
nom[place][3]='\0';
printf("%s\n",nom[place]);
}
fclose(hallOfFame);
}
else{
printf("c'est toi qui est null\n");
}
return 0;
}

View File

@@ -0,0 +1,22 @@
#include<stdlib.h>
#include<stdio.h>
int main(void){
int place;
char nom[10][4];
int score[10];
FILE* hallOfFame = fopen("top10","r");
if (hallOfFame){
for (place=0;place<10;place++){
fread(&score[place],sizeof(int),1,hallOfFame);
printf("%09d",score[place]);
fread(&nom[place],sizeof(char),3,hallOfFame);
nom[place][3]='\0';
printf("%4s\n",nom[place]);
}
fclose(hallOfFame);
}
else{
printf("c'est toi qui est null\n");
}
return 0;
}

View File

@@ -0,0 +1,83 @@
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
void inversionInt(int* var1, int* var2){
int valeurTransitoire = *var1;
*var1 = *var2;
*var2 = valeurTransitoire;
}
void inversionMot3(char* var1, char* var2){
char valeurTransitoire;
int pos;
for (pos=0; pos<4; pos++, var1++, var2++){
valeurTransitoire = *var1;
*var1 = *var2;
*var2 = valeurTransitoire;
}
}
void printTop10(int* score, char* challenger){
int place;
for (place=0; place<10; place++, score++, challenger+=4){
printf("%09d",*score);
printf("%4s\n",challenger);
}
printf("\n");
}
int main(int argc, char** argv){
int place;
int score[10];
int newScore=NULL;
char challenger[10][4];
char newChallenger[4];
if (argc > 2){
newScore = (int) strtol(argv[1], NULL, 10);
for (place=0;place<4;place++){
newChallenger[place] = argv[2][place];
}
newChallenger[3] = '\0';
}
FILE* hallOfFame = fopen("top10","r");
if (hallOfFame){
for (place=0;place<10;place++){
fread(&score[place],sizeof(int),1,hallOfFame);
fread(&challenger[place],sizeof(char),3,hallOfFame);
challenger[place][3]='\0';
}
fclose(hallOfFame);
printTop10(&score, &challenger);
for (place=0;place<10;place++){
if (newScore>score[place]){
inversionInt(&newScore, &score[place]);
inversionMot3(&newChallenger, &challenger[place]);
}
}
}
else{
printf("Le fichier n'as pas réussi à s'ouvrir pour la lecture\n");
}
hallOfFame = fopen("top10","w");
if (hallOfFame){
for (place=0;place<10;place++){
fwrite(&score[place],sizeof(int),1,hallOfFame);
fwrite(&challenger[place],sizeof(char),3,hallOfFame);
}
fclose(hallOfFame);
printTop10(&score, &challenger);
for (place=0;place<10;place++){
if (newScore>score[place]){
inversionInt(&newScore, &score[place]);
inversionMot3(&newChallenger, &challenger[place]);
}
}
fclose(hallOfFame);
}
else{
printf("Le fichier n'as pas réussi à s'ouvrir lors de sa réécriture\n");
}
return 0;
}

View File

@@ -0,0 +1,22 @@
#include<stdlib.h>
#include<stdio.h>
int main(void){
int place;
char nom[10][4];
int score[10];
FILE* hallOfFame = fopen("top10","r");
if (hallOfFame){
for (place=0;place<10;place++){
fread(&score[place],sizeof(int),1,hallOfFame);
printf("%09d",score[place]);
fread(&nom[place],sizeof(char),3,hallOfFame);
nom[place][3]='\0';
printf("%4s\n",nom[place]);
}
fclose(hallOfFame);
}
else{
printf("c'est toi qui est null\n");
}
return 0;
}

View File

View File

@@ -0,0 +1,21 @@
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
int main(int argc, char** argv){
FILE* fichier = NULL;
char ligne[100];
int numLigne=0;
if (argc > 1){
fichier = fopen(argv[1],"r");
if (fichier){
for (numLigne=0; fgets(ligne,100,fichier)!=NULL; numLigne++){
printf("%d) %s",numLigne, ligne);
}
}
else{
printf("%s n'existe pas ou ne peut pas s'ouvrir",argv[1]);
}
}
return 0;
}

View File

@@ -0,0 +1,13 @@
#include<stdio.h>
int decToBin(char d){
printf("%d",(int)d);
return 0;
}
int main(int argc, char** argv){
char test = 'a';
charToBin(test);
return 0;
}

View File

BIN
DEV/DEV1.1_suite/Fichiers/exe Executable file

Binary file not shown.

View File

@@ -0,0 +1,84 @@
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
int main(int argc, char** argv){
FILE* fichierScr = NULL;
FILE* fichierDes = NULL;
char caractere[2];
int arg=0;
if (argc > 2){
if (argc > 3){
arg++;
fichierDes = fopen(argv[3],"a");
}
else{
fichierDes = fopen(argv[2],"w");
}
fichierScr = fopen(argv[arg+1],"r");
if (fichierScr){
if (fichierDes){
while (fread(caractere,sizeof(char),1,fichierScr)!=0){
fwrite(caractere,sizeof(char),1,fichierDes);
}
return 0;
}
else{
printf("%s n'existe pas ou ne peut pas s'ouvrir\n",argv[2]);
return 1;
}
}
else{
printf("%s n'existe pas ou ne peut pas s'ouvrir\n",argv[1]);
return 1;
}
}
else{
printf("Utilisation: argv[0] <fichier_source> <fichier_destination>\n");
return 0;
}
}
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
int main(int argc, char** argv){
FILE* fichierScr = NULL;
FILE* fichierDes = NULL;
char caractere[2];
int arg=0;
if (argc > 2){
if (argc > 3){
arg++;
fichierDes = fopen(argv[3],"a");
}
else{
fichierDes = fopen(argv[2],"w");
}
fichierScr = fopen(argv[arg+1],"r");
if (fichierScr){
if (fichierDes){
while (fread(caractere,sizeof(char),1,fichierScr)!=0){
fwrite(caractere,sizeof(char),1,fichierDes);
}
return 0;
}
else{
printf("%s n'existe pas ou ne peut pas s'ouvrir\n",argv[2]);
return 1;
}
}
else{
printf("%s n'existe pas ou ne peut pas s'ouvrir\n",argv[1]);
return 1;
}
}
else{
printf("Utilisation: argv[0] <fichier_source> <fichier_destination>\n");
return 0;
}
}

Binary file not shown.