maybe the last commit of first screen
This commit is contained in:
@@ -1,130 +1,121 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>//utile pour la creation d'un nombre aleatoire
|
#include <time.h>//utile pour la creation d'un nombre aleatoire
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*fonction qui permet de creer le random en fonction des resultats precedents*/
|
/*fonction qui permet de creer le random en fonction des resultats precedents*/
|
||||||
int Random (int _imin, int _imax)
|
int Random (int _imin, int _imax)
|
||||||
|
{
|
||||||
|
return (_imin + (rand () % (_imax-_imin+1)));//explication ???
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
|
||||||
{
|
{
|
||||||
return (_imin + (rand () % (_imax-_imin+1)));//explication ???
|
system("gcc -o heure-vrai heure-vrai.c;./heure-vrai");//utilisation de heure-vrai.c pour afficher l'heure dasn l historique
|
||||||
}
|
/*clear the screen , open picture and history , write type of lock screen in history */
|
||||||
|
//system("clear");
|
||||||
|
FILE* fichier = NULL;//declare fichier et history comme des pointeurs de FILE
|
||||||
|
FILE* history = NULL;
|
||||||
|
history = fopen("/media/groupe-tvp/b919f1b0-9122-4865-a76b-bb6386984916/doc/history.txt", "a");
|
||||||
|
fprintf(history," statique ");//ecriture dans l historique du type d affichage
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int caractereactuel = 0;//creation de notre caractere actuel
|
||||||
|
int nbrAlea;//nombre aleatoire
|
||||||
|
int linecounter = 0;//compteur de ligne
|
||||||
|
|
||||||
|
|
||||||
|
srand (time (NULL));//créer nbr alea entre 1 et 5 pour choisir entre les differentes images
|
||||||
|
nbrAlea = Random (1,5);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
|
|
||||||
{
|
|
||||||
system("gcc -o heure-vrai heure-vrai.c;./heure-vrai");
|
|
||||||
/*clear the screen , open picture and history , write type of lock screen in history */
|
|
||||||
system("clear");
|
|
||||||
FILE* fichier = NULL;
|
|
||||||
FILE* history = NULL;
|
|
||||||
history = fopen("/media/groupe-tvp/b919f1b0-9122-4865-a76b-bb6386984916/doc/history.txt", "a");
|
|
||||||
fprintf(history," statique ");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int caractereactuel = 0;//creation de notre caractere actuel
|
|
||||||
int nbrAlea;//nombre aleatoire
|
|
||||||
int linecounter = 0;//compteur de ligne
|
|
||||||
|
|
||||||
|
|
||||||
srand (time (NULL));//créer nbr alea entre 1 et 5 pour choisir entre les differentes images
|
|
||||||
nbrAlea = Random (1,5);
|
|
||||||
|
|
||||||
|
|
||||||
fprintf(history," image: ");
|
fprintf(history," image: ");
|
||||||
/*switch qui permet d'ouvrir une image en fonction d'un nombre aleatoire entre 1 et 5 */
|
/*switch qui permet d'ouvrir une image en fonction d'un nombre aleatoire entre 1 et 5 */
|
||||||
switch(nbrAlea)
|
switch(nbrAlea)
|
||||||
{case 1:
|
{case 1:
|
||||||
fichier = fopen("image1", "r");
|
fichier = fopen("image1-2", "r");
|
||||||
fprintf(history," je suis en pause");
|
fprintf(history," je suis en pause");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
fichier = fopen("image2", "r");
|
fichier = fopen("image2-2", "r");
|
||||||
fprintf(history," tetris");
|
fprintf(history," tetris");
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
fichier = fopen("image3", "r");
|
fichier = fopen("image3-2", "r");
|
||||||
fprintf(history," start to continue");
|
fprintf(history," start to continue");
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
fichier = fopen("image4", "r");
|
fichier = fopen("image4-2", "r");
|
||||||
fprintf(history," psychédélique");
|
fprintf(history," psychédélique");
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
fichier = fopen("image5", "r");
|
fichier = fopen("image5-2", "r");
|
||||||
fprintf(history," jul");
|
fprintf(history," jul");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fichier != NULL)//
|
if (fichier != NULL)//
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
// boucle de lecture des caracteres un a un
|
// boucle de lecture des caracteres un a un
|
||||||
|
|
||||||
do
|
do
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
caractereactuel = fgetc(fichier); // on lit le caractere
|
caractereactuel = fgetc(fichier); // on lit le caractere
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
switch(caractereactuel)
|
||||||
|
{
|
||||||
|
case 49: //1
|
||||||
|
printf("%c",987);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 48: //0
|
||||||
|
printf("%c",240);
|
||||||
|
break;
|
||||||
|
case '\t': //tab
|
||||||
|
//vide pour empecher que \t soit considerer comme default
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
printf("\n ");
|
||||||
|
linecounter++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// printf("%c", caractereactuel); // on l'affiche
|
|
||||||
|
|
||||||
//printf("%d",compt);
|
|
||||||
|
|
||||||
switch(caractereactuel)
|
|
||||||
{
|
|
||||||
case 49: //1
|
|
||||||
printf("%c",987);
|
|
||||||
|
|
||||||
break;
|
} while (linecounter < 28 ); // on continue tant que compteurglobal n'a pas finis le fichier
|
||||||
case 48: //0
|
|
||||||
printf("%c",240);
|
|
||||||
break;
|
|
||||||
case '\t': //tab
|
fclose(fichier);//fermeture des fichiers
|
||||||
//printf("er");
|
fclose(history);
|
||||||
break;
|
|
||||||
//case
|
}
|
||||||
default:
|
//attente de l appui d une touche
|
||||||
printf("\n");
|
system("stty cbreak -echo");
|
||||||
linecounter++;
|
getchar();
|
||||||
break;
|
system("stty cooked -echo");
|
||||||
|
system("clear");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} while (linecounter < 30 ); // on continue tant que compteurglobal n'a pas finis le fichier
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fclose(fichier);
|
|
||||||
fclose(history);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
system("stty cbreak -echo");
|
|
||||||
getchar();
|
|
||||||
system("stty cooked -echo");
|
|
||||||
system("clear");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user