Ajout des travaux effectuer
This commit is contained in:
42
23DEV1.1/TPS1/TP2/20-Fichier/Challenger.c
Normal file
42
23DEV1.1/TPS1/TP2/20-Fichier/Challenger.c
Normal file
@@ -0,0 +1,42 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
FILE *f;
|
||||
f=fopen("top10","r");
|
||||
int zone_int[1];
|
||||
int zone_char[3];
|
||||
int i = 0;
|
||||
int j;
|
||||
char name[3];
|
||||
int score;
|
||||
char rep_n;
|
||||
int rep_s;
|
||||
printf("Entrez pseudo : ");
|
||||
while(i<3){
|
||||
name[i] = getchar();
|
||||
i++;
|
||||
}
|
||||
printf("Entrez score : ");
|
||||
scanf("%d", score);
|
||||
if(f != NULL){
|
||||
for(i=0 ; i<10 ; i++){
|
||||
fread(zone_int, 4, 1, f);
|
||||
fread(zone_char, 3, 1, f);
|
||||
if(zone_int[0] <= score){
|
||||
rep_n = zone_int[1];
|
||||
rep_s = zone_char[3];
|
||||
zone_int[0] = score;
|
||||
zone_char[3] = name[3];
|
||||
name[3] = rep_n;
|
||||
score = rep_s;
|
||||
}
|
||||
printf("%09d", zone_int[0]);
|
||||
printf("%c%c%c", zone_char[0], zone_char[1], zone_char[2]);
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
17
23DEV1.1/TPS1/TP2/20-Fichier/Copie.c
Normal file
17
23DEV1.1/TPS1/TP2/20-Fichier/Copie.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
FILE *f;
|
||||
FILE *l;
|
||||
f=fopen(argv[1],"r");
|
||||
l=fopen(argv[2],"w");
|
||||
char t[40];
|
||||
fgets(t,40,f);
|
||||
fputs(t,l);
|
||||
fclose(l);
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
BIN
23DEV1.1/TPS1/TP2/20-Fichier/Suite/Compteur
Executable file
BIN
23DEV1.1/TPS1/TP2/20-Fichier/Suite/Compteur
Executable file
Binary file not shown.
26
23DEV1.1/TPS1/TP2/20-Fichier/Suite/Compteur.c
Normal file
26
23DEV1.1/TPS1/TP2/20-Fichier/Suite/Compteur.c
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
int time = 0;
|
||||
FILE* f;
|
||||
f=fopen("compteur","r");
|
||||
if(f == NULL){
|
||||
f=fopen("compteur","w");
|
||||
fwrite(&time,1,4,f);
|
||||
time = 1;
|
||||
printf("Nombres de fois ouvert : inexistant\n");
|
||||
fclose(f);
|
||||
}
|
||||
else{
|
||||
fread(&time,1,4,f);
|
||||
f=fopen("compteur","w");
|
||||
time++;
|
||||
fwrite(&time,1,4,f);
|
||||
printf("Nombres de fois ouvert : %d\n", time);
|
||||
fclose(f);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
27
23DEV1.1/TPS1/TP2/20-Fichier/Suite/Hexadecimal.c
Normal file
27
23DEV1.1/TPS1/TP2/20-Fichier/Suite/Hexadecimal.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
FILE* f;
|
||||
int i;
|
||||
int n = 0;
|
||||
int y;
|
||||
char c[100];
|
||||
f=fopen(argv[1],"r");
|
||||
while(feof(f)==1){
|
||||
for(i=0;i<y;i++){
|
||||
if( c[i] ='\n'){
|
||||
printf("\n");
|
||||
n=n+10;
|
||||
}else{
|
||||
printf("%07d ",n);
|
||||
fread(&c,3,1,f);
|
||||
printf("%c ", c[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
37
23DEV1.1/TPS1/TP2/20-Fichier/Suite/Image.c
Normal file
37
23DEV1.1/TPS1/TP2/20-Fichier/Suite/Image.c
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <graph.h>
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
FILE* f;
|
||||
f = fopen("image.bin","r");
|
||||
int i, j;
|
||||
int largeur, hauteur;
|
||||
couleur c;
|
||||
|
||||
fread(&largeur,4,1,f);
|
||||
fread(&hauteur,4,1,f);
|
||||
|
||||
printf("%d\n",largeur);
|
||||
printf("%d\n",hauteur);
|
||||
|
||||
InitialiserGraphique();
|
||||
CreerFenetre(10, 10, largeur, hauteur);
|
||||
fseek(f,8*largeur/2*hauteur,SEEK_CUR);
|
||||
for(i=largeur/2;i<largeur;i++){
|
||||
|
||||
fseek(f,8*hauteur/2,SEEK_CUR);
|
||||
|
||||
for(j=hauteur/2;j<hauteur;j++){
|
||||
fread(&c,sizeof(unsigned long),1,f);
|
||||
ChoisirCouleurDessin(c);
|
||||
DessinerPixel(i, j);
|
||||
}
|
||||
|
||||
}
|
||||
Touche();
|
||||
FermerGraphique();
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
BIN
23DEV1.1/TPS1/TP2/20-Fichier/Suite/a.out
Executable file
BIN
23DEV1.1/TPS1/TP2/20-Fichier/Suite/a.out
Executable file
Binary file not shown.
BIN
23DEV1.1/TPS1/TP2/20-Fichier/Suite/compteur
Normal file
BIN
23DEV1.1/TPS1/TP2/20-Fichier/Suite/compteur
Normal file
Binary file not shown.
BIN
23DEV1.1/TPS1/TP2/20-Fichier/Suite/image.bin
Normal file
BIN
23DEV1.1/TPS1/TP2/20-Fichier/Suite/image.bin
Normal file
Binary file not shown.
1
23DEV1.1/TPS1/TP2/20-Fichier/Takedown.txt
Normal file
1
23DEV1.1/TPS1/TP2/20-Fichier/Takedown.txt
Normal file
@@ -0,0 +1 @@
|
||||
plus que 3 (Répétition, Reproduction, Recherche).
|
||||
BIN
23DEV1.1/TPS1/TP2/20-Fichier/a.out
Executable file
BIN
23DEV1.1/TPS1/TP2/20-Fichier/a.out
Executable file
Binary file not shown.
21
23DEV1.1/TPS1/TP2/20-Fichier/record.c
Normal file
21
23DEV1.1/TPS1/TP2/20-Fichier/record.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
int s;
|
||||
char b[3];
|
||||
int i;
|
||||
FILE* f;
|
||||
f=fopen("top10","r");
|
||||
printf("|Hall of Fame|\n");
|
||||
for(i=0;i<10;i++){
|
||||
fread(&s,4,1,f);
|
||||
fread(&b,3,1,f);
|
||||
printf("%09d %s\n", s, b);
|
||||
}
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
0
23DEV1.1/TPS1/TP2/20-Fichier/roger.gif
Normal file
0
23DEV1.1/TPS1/TP2/20-Fichier/roger.gif
Normal file
0
23DEV1.1/TPS1/TP2/20-Fichier/steve.gif
Normal file
0
23DEV1.1/TPS1/TP2/20-Fichier/steve.gif
Normal file
BIN
23DEV1.1/TPS1/TP2/20-Fichier/top10
Normal file
BIN
23DEV1.1/TPS1/TP2/20-Fichier/top10
Normal file
Binary file not shown.
Reference in New Issue
Block a user