html css tp02
This commit is contained in:
BIN
APL1.2/Dev1.2/Fichiers/Compteur
Executable file
BIN
APL1.2/Dev1.2/Fichiers/Compteur
Executable file
Binary file not shown.
34
APL1.2/Dev1.2/Fichiers/Compteur.C
Normal file
34
APL1.2/Dev1.2/Fichiers/Compteur.C
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
int main(int argc, char* const argv[])
|
||||
{
|
||||
FILE *file;
|
||||
int a;
|
||||
int cpt;
|
||||
int i;
|
||||
int b=0;
|
||||
if(file = fopen("cpt", "r"))
|
||||
{
|
||||
fclose(file);
|
||||
file = fopen("cpt", "w");
|
||||
fread(&a,sizeof(int),1,file);
|
||||
b=a+1;
|
||||
printf("%d", a);
|
||||
fclose(file);
|
||||
file = fopen("cpt", "w");
|
||||
fwrite(&b,sizeof(int),1,file);
|
||||
fclose(file);
|
||||
}
|
||||
else
|
||||
{
|
||||
fclose(file);
|
||||
file = fopen("cpt", "w");
|
||||
fread(&a,sizeof(int),1,file);
|
||||
fwrite(&b,sizeof(int),1,file);
|
||||
}
|
||||
/*
|
||||
f
|
||||
*/
|
||||
return EXIT_SUCCESS;
|
||||
}
|
27
APL1.2/Dev1.2/Fichiers/Image.c
Normal file
27
APL1.2/Dev1.2/Fichiers/Image.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <graph.h>
|
||||
int main(int argc, char const argv[])
|
||||
{
|
||||
FILE *flux;
|
||||
int a=0;
|
||||
int b=0;
|
||||
int cpt=0;
|
||||
int nb_pix=0;
|
||||
int color;
|
||||
flux = fopen("image.bin", "r");
|
||||
fread(&a,sizeof(int),1,flux);
|
||||
fread(&b,sizeof(int),1,flux);
|
||||
printf("%d\n", a);
|
||||
printf("%d\n", b);
|
||||
nb_pix = a*b;
|
||||
while(cpt <= nb_pix)
|
||||
{
|
||||
fread(&color, sizeof(int),1,flux);
|
||||
printf("couleur : %d\n", color);
|
||||
cpt=cpt+1;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
1
APL1.2/Dev1.2/Fichiers/cpt
Normal file
1
APL1.2/Dev1.2/Fichiers/cpt
Normal file
@@ -0,0 +1 @@
|
||||
<EFBFBD>@
|
BIN
APL1.2/Dev1.2/Fichiers/image
Executable file
BIN
APL1.2/Dev1.2/Fichiers/image
Executable file
Binary file not shown.
BIN
APL1.2/Dev1.2/Fichiers/image.bin
Normal file
BIN
APL1.2/Dev1.2/Fichiers/image.bin
Normal file
Binary file not shown.
Reference in New Issue
Block a user