1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<conio.h>
#include <windows.h>
#include "projet.h"
#define SHIFT 224
int main()
{
int i=0;
char nom[20];
char choix, titre[]="BIENVENUE DANS LE MINI_PROJET REALISE PAR: ******";
struct elt *start=NULL;
struct elt *etudiant_cherche = NULL, *c = NULL;
char matricule[10];
char * NomFic="Data.txt";
//CODE COULEUR-----------------------
// TRES DURE POUR FAIRE COLORER TOUT LE PROGRAMME-----------
void *hconsole;// c'est un hdandl un pointeur pour la console.
unsigned long nbrCar; //mettre en couleur le nbr de lettres souhaiter || afficher.
int fsuccess; // pour tester la fonction -0 si erreur
unsigned short WColors[60]; //tableau pour chaque caractère le mettre en couleur.
COORD coord; // type de donnés ds windows.h "type=COORD"
coord.X=10; // nombre de caractères entre la bordure gauche et le debut de la phrase
coord.Y=5; // nbr de carctères entre la bordure du haut....
hconsole=GetStdHandle(STD_OUTPUT_HANDLE);// adresse de la console..
fsuccess=WriteConsoleOutputCharacter(hconsole, titre, strlen(titre), coord, &nbrCar);//comme printf WriteConsoleOutputCharacter
for(i=0; i<=strlen(titre); i++)
WColors[i]=FOREGROUND_RED;
fsuccess=WriteConsoleOutputAttribute(hconsole, WColors, strlen(titre), coord, &nbrCar);
//PLEIN ECRAN --------------------------------------------
keybd_event(VK_MENU,0x38,0,0);
keybd_event(VK_RETURN,0x1c,0,0);
keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0);
keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0);
//--------------------------------------------------------
printf("\n\n\n\n\n\n\n\n\n\n\n =======================================================================");
printf("\n\n\tAppuyez sur ENTER pour acceder au menu ou AUTRES pour quitter");
printf("\n\n =======================================================================\n\n");
i=GetKey();
if(i==13)
{
while(1)
{
do
{
menu();
printf("\n\n\nEntrez votre choix:");
scanf("%c",&choix);
if((int)choix>=97)
choix-=32;
switch(choix)
{
case 65:
system("cls");
start=saisie(start);
break;
case 66:
system("cls");
afficher(start);
getch();
break;
case 67:
{
system("cls");
printf("Entrez le Numero detudiant que vous recherchez:");
fflush(stdin); // vide le buffer
gets(matricule);
etudiant_cherche = rechercher(start, matricule);
afficher_etudiant(etudiant_cherche);
}break;
case 68:
{
system("cls");
printf("Entrez le nom detudiant que vous cherchez:");
fflush(stdin);
gets(nom);
etudiant_cherche=rechercher_nom(start, nom);
afficher_etudiant(etudiant_cherche);
}break;
case 69:
{
system("del Data.txt");
system("cls");
if ( (elt = ajouter_etudiant(&c, NOM, PRENOM, date_naissance, matricule, budget)) != NULL )
{
enregistrer_fichier(elt,NomFic);
printf("\n\n\n\t\tEtudiants enregistres. Merci\n");
}
printf("\t\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nAppuyez sur une touche pour retourner au menu principal");
getch();
}break;
case 81:
return 0;
default:printf("Mauvais choix\n");
}
}
while(choix<65 || choix>69 );
}
}
if(i==27)
exit(0);
CloseHandle(hconsole);
return 0;
} |