all contents of dynamic
This commit is contained in:
@@ -0,0 +1,328 @@
|
||||
|
||||
/*fonction qui permet l'ouverture des fichiers en fonction d un chiffre entre 0 et 9 qui correspond a une heure , dizaine d heure, minutes, dizaines minutes ...*/
|
||||
FILE* ouverture(int temps) {//----ouverture
|
||||
FILE* fichier=NULL;
|
||||
switch(temps)
|
||||
{
|
||||
case 0:
|
||||
fichier = fopen("0","r");
|
||||
break;
|
||||
case 1:
|
||||
fichier = fopen("1","r");
|
||||
break;
|
||||
case 2:
|
||||
fichier = fopen("2","r");
|
||||
break;
|
||||
case 3:
|
||||
fichier = fopen("3","r");
|
||||
break;
|
||||
case 4:
|
||||
fichier = fopen("4","r");
|
||||
break;
|
||||
case 5:
|
||||
fichier = fopen("5","r");
|
||||
break;
|
||||
case 6:
|
||||
fichier = fopen("6","r");
|
||||
break;
|
||||
case 7:
|
||||
fichier = fopen("7","r");
|
||||
break;
|
||||
case 8:
|
||||
fichier = fopen("8","r");
|
||||
break;
|
||||
case 9:
|
||||
fichier = fopen("9","r");
|
||||
break;
|
||||
return fichier;
|
||||
}}//------------------------ouverture
|
||||
|
||||
/*fonction qui permet de cnetrer une image dans u_n tableau */
|
||||
int centre(void)
|
||||
{
|
||||
char v=0;
|
||||
int tableau1[1920];
|
||||
char b=0;
|
||||
int L=0;
|
||||
int C=0;
|
||||
int col=0;
|
||||
int lin=0;
|
||||
int o=0;
|
||||
while (v!='\0')
|
||||
{
|
||||
while (b!='\n')
|
||||
{
|
||||
b= fgetc(fichier);
|
||||
C++;
|
||||
}
|
||||
// v= fgetc(fichier);//peut etre pas besoin
|
||||
L++;
|
||||
b=0;
|
||||
}
|
||||
col=(80-C)/2;
|
||||
lin=(80-L)/2;
|
||||
for (o=80*lin+col+1; o<=80*24-(80*lin+col+1); o++)
|
||||
{
|
||||
v=0;
|
||||
v= fgetc(fichier);
|
||||
tableau1[o]=v;
|
||||
if (o%80==79-col)
|
||||
{
|
||||
o+=C+1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void afficherTableauH1(int* tableau2)
|
||||
{//------------------------------------------------------------------------------------void
|
||||
|
||||
FILE* HEURE1= NULL;
|
||||
HEURE1=ouverture(dizaines_h);
|
||||
char c = 0;
|
||||
int i=0;
|
||||
int cpt = 0;
|
||||
|
||||
while ( cpt < 2) {//--------------------------------while
|
||||
c= fgetc(HEURE1);
|
||||
if (c == '\n')
|
||||
{//------------------------------------------------if
|
||||
cpt++; }//----------------------------------------------if
|
||||
}//-------------------------------------------------while
|
||||
|
||||
|
||||
do {//-------------------------------------------------------------------do/while
|
||||
c= fgetc(HEURE1);
|
||||
if(c == '0' || c == '1') {//--------------------if
|
||||
tableau2[i++] = c;
|
||||
|
||||
}//---------------------------------------------if
|
||||
}while(c != EOF);//------------------------------------------------------do/while
|
||||
|
||||
}//--------------------------------------------------------------------------------------------------------------------------------------------------------------main
|
||||
|
||||
|
||||
void afficherTableauH2(int* tableau2)
|
||||
{//------------------------------------------------------------------------------------void
|
||||
|
||||
FILE* HEURE2= NULL;
|
||||
HEURE2=ouverture(unites_h);
|
||||
char c = 0;
|
||||
int i=0;
|
||||
int cpt = 0;
|
||||
|
||||
while ( cpt < 2) {//--------------------------------while
|
||||
c= fgetc(HEURE2);
|
||||
if (c == '\n')
|
||||
{//------------------------------------------------if
|
||||
cpt++; }//----------------------------------------------if
|
||||
}//-------------------------------------------------while
|
||||
|
||||
|
||||
do {//-------------------------------------------------------------------do/while
|
||||
c= fgetc(HEURE2);
|
||||
if(c == '0' || c == '1') {//--------------------if
|
||||
tableau2[i++] = c;
|
||||
|
||||
}//---------------------------------------------if
|
||||
}while(c != EOF);//------------------------------------------------------do/while
|
||||
|
||||
}//--------------------------------------------------------------------------------------------------------------------------------------------------------------main
|
||||
|
||||
|
||||
|
||||
void afficherTableauM1(int* tableau2)
|
||||
{//------------------------------------------------------------------------------------void
|
||||
|
||||
FILE* MIN1= NULL;
|
||||
MIN1=ouverture(dizaines_m);
|
||||
char c = 0;
|
||||
int i=0;
|
||||
int cpt = 0;
|
||||
|
||||
while ( cpt < 2) {//--------------------------------while
|
||||
c= fgetc(MIN1);
|
||||
if (c == '\n')
|
||||
{//------------------------------------------------if
|
||||
cpt++; }//----------------------------------------------if
|
||||
}//-------------------------------------------------while
|
||||
|
||||
|
||||
do {//-------------------------------------------------------------------do/while
|
||||
c= fgetc(MIN1);
|
||||
if(c == '0' || c == '1') {//--------------------if
|
||||
tableau2[i++] = c;
|
||||
|
||||
}//---------------------------------------------if
|
||||
}while(c != EOF);//------------------------------------------------------do/while
|
||||
|
||||
}//--------------------------------------------------------------------------------------------------------------------------------------------------------------main
|
||||
|
||||
|
||||
void afficherTableauM2(int* tableau2)
|
||||
{//------------------------------------------------------------------------------------void
|
||||
|
||||
FILE* MIN2= NULL;
|
||||
MIN2=ouverture(unites_m);
|
||||
char c = 0;
|
||||
int i=0;
|
||||
int cpt = 0;
|
||||
|
||||
while ( cpt < 2) {//--------------------------------while
|
||||
c= fgetc(MIN2);
|
||||
if (c == '\n')
|
||||
{//------------------------------------------------if
|
||||
cpt++; }//----------------------------------------------if
|
||||
}//-------------------------------------------------while
|
||||
|
||||
|
||||
do {//-------------------------------------------------------------------do/while
|
||||
c= fgetc(MIN2);
|
||||
if(c == '0' || c == '1') {//--------------------if
|
||||
tableau2[i++] = c;
|
||||
|
||||
}//---------------------------------------------if
|
||||
}while(c != EOF);//------------------------------------------------------do/while
|
||||
|
||||
}//--------------------------------------------------------------------------------------------------------------------------------------------------------------main
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void afficherTableauS1(int* tableau2)
|
||||
{//------------------------------------------------------------------------------------void
|
||||
|
||||
FILE* SEC1= NULL;
|
||||
SEC1=ouverture(dizaines_s);
|
||||
char c = 0;
|
||||
int i=0;
|
||||
int cpt = 0;
|
||||
|
||||
while ( cpt < 2) {//--------------------------------while
|
||||
c= fgetc(SEC1);
|
||||
if (c == '\n')
|
||||
{//------------------------------------------------if
|
||||
cpt++; }//----------------------------------------------if
|
||||
}//-------------------------------------------------while
|
||||
|
||||
|
||||
do {//-------------------------------------------------------------------do/while
|
||||
c= fgetc(SEC1);
|
||||
if(c == '0' || c == '1') {//--------------------if
|
||||
tableau2[i++] = c;
|
||||
|
||||
}//---------------------------------------------if
|
||||
}while(c != EOF);//------------------------------------------------------do/while
|
||||
|
||||
}//--------------------------------------------------------------------------------------------------------------------------------------------------------------main
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void afficherTableauS2(int* tableau2)
|
||||
{//------------------------------------------------------------------------------------void
|
||||
|
||||
FILE* SEC2= NULL;
|
||||
SEC2=ouverture(unites_s);
|
||||
char c = 0;
|
||||
int i=0;
|
||||
int cpt = 0;
|
||||
|
||||
while ( cpt < 2)
|
||||
{//--------------------------------while
|
||||
c= fgetc(SEC2);
|
||||
if (c == '\n')
|
||||
{//------------------------------------------------if
|
||||
cpt++;
|
||||
}//----------------------------------------------if
|
||||
}//-------------------------------------------------while
|
||||
|
||||
|
||||
do {//-------------------------------------------------------------------do/while
|
||||
c= fgetc(SEC2);
|
||||
if(c == '0' || c == '1') {//--------------------if
|
||||
tableau2[i++] = c;
|
||||
|
||||
}//---------------------------------------------if
|
||||
}while(c != EOF);//------------------------------------------------------do/while
|
||||
|
||||
}//-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
{
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
|
||||
for (i = 0; i < 5; i++) {//------------------------------------------------------for
|
||||
for(j = 0; j < 23; j++){ //------------for
|
||||
|
||||
if (tableau2[i*24+j]=='0')
|
||||
{
|
||||
printf(" ");
|
||||
}
|
||||
else {
|
||||
printf("%c",987);
|
||||
}
|
||||
}//------------------------------------------------------------------------------for
|
||||
printf("\n");
|
||||
|
||||
}//------------------------------------------------------------------for
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void mettredstbl(void);
|
||||
{
|
||||
int ecrire;
|
||||
FILE* tbl245=NULL;
|
||||
tbl245=fopen("tableau245",w);
|
||||
for (ecrire=0;ecrire=119; ecire++)
|
||||
{
|
||||
fprintf(tableau245,tableau2[ecrire]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void lirefichier(void);
|
||||
{
|
||||
|
||||
int r;
|
||||
FILE* tbl245=NULL;
|
||||
tbl245=fopen("tableau245",r);
|
||||
r=fgetc(tbl245);
|
||||
switch (r)
|
||||
case 0:
|
||||
{
|
||||
printf(" ");
|
||||
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
printf("%c",987);
|
||||
|
||||
}
|
||||
case '\n':
|
||||
{
|
||||
int bordure;
|
||||
for (bordure=0; bordure=55; bordure++)
|
||||
{
|
||||
printf(" ");
|
||||
}
|
||||
|
||||
}
|
||||
case '\0':
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user