add news function

This commit is contained in:
thibault62
2016-12-14 11:36:04 +01:00
committed by GitHub
parent e32f7631ff
commit 903471d251
+308 -4
View File
@@ -1,4 +1,4 @@
/*fonction qui permet l'ouverture des fichiers*/
/*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)
@@ -33,8 +33,312 @@ break;
case 9:
fichier = fopen("9","r");
break;
default:
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;
}
}//------------------------ouverture
//----------------------------------------------------------------------
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
int i = 0;
int j = 0;
for (i = 0; i < 5; i++) {//------------------------------------------------------for
for(j = 0; j < 3; j++){ //------------for
if (tableau2[i*24+j]=='0'){
printf(" ");
}
else {
printf("%c",987);
}
}//------------------------------------------------------------------------------for
printf("\n");
}//------------------------------------------------------------------for
}//--------------------------------------------------------------------------------------------------------------------------------------------------------------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
int i = 0;
int j = 0;
for (i = 0; i < 5; i++) {//------------------------------------------------------for
for(j = 4; j < 7; j++){ //------------for
if (tableau2[i*24+j]=='0'){
printf(" ");
}
else {
printf("%c",987);
}
}//------------------------------------------------------------------------------for
printf("\n");
}//------------------------------------------------------------------for
}//--------------------------------------------------------------------------------------------------------------------------------------------------------------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
int i = 0;
int j = 0;
for (i = 0; i < 5; i++) {//------------------------------------------------------for
for(j = 10; j < 13; j++){ //------------for
if (tableau2[i*24+j]=='0'){
printf(" ");
}
else {
printf("%c",987);
}
}//------------------------------------------------------------------------------for
printf("\n");
}//------------------------------------------------------------------for
}//--------------------------------------------------------------------------------------------------------------------------------------------------------------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
int i = 0;
int j = 0;
for (i = 0; i < 5; i++) {//------------------------------------------------------for
for(j = 13; j < 16; j++){ //------------for
if (tableau2[i*24+j]=='0'){
printf(" ");
}
else {
printf("%c",987);
}
}//------------------------------------------------------------------------------for
printf("\n");
}//------------------------------------------------------------------for
}//--------------------------------------------------------------------------------------------------------------------------------------------------------------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
int i = 0;
int j = 0;
for (i = 0; i < 5; i++) {//------------------------------------------------------for
for(j = 19; j < 22; j++){ //------------for
if (tableau2[i*24+j]=='0'){
printf(" ");
}
else {
printf("%c",987);
}
}//------------------------------------------------------------------------------for
printf("\n");
}//------------------------------------------------------------------for
}//--------------------------------------------------------------------------------------------------------------------------------------------------------------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 = 22; j < 26; j++){ //------------for
if (tableau2[i*24+j]=='0'){
printf(" ");
}
else {
printf("%c",987);
}
}//------------------------------------------------------------------------------for
printf("\n");
}//------------------------------------------------------------------for
}//-------------------------------------------------------------------------------