| 12
 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
 
 | //Main
 
int _tmain(int argc, _TCHAR* argv[])
{
	// Prototypes
	void INSCRIPTION(struct contact [], int [], int, int);
	void SUPPRESSION(struct contact [], int [], int, int);
 
 
	char code;
	contact Tab[100];
	int j=0, TI[100], TI2[100], pro=0;
	CH20 nomLu, prenomLu;
	CH10 telLu;
	CH5 codeCatLu;
 
	printf("\t\tGestion du repertoire telephonique\n\n");
	printf("Veuillez entrer :\n\tI pour inscrire une personne\n\tS pour supprimer une personne\n\tM pour modifier une personne\n\tT pour afficher tout le repertoire\n\t");
	printf("A pour afficher les relations personnelles\n\tP pour afficher les relations professionnelles\n\tR pour rechercher le telephone d'une personne\n\t");
	printf("N pour rechercher les telephones d'un certain nom\n\tB pour rechercher une personne dont on connait le telephone\n\tQ pour quitter");
    printf("\nRentrez le code : ");
	code = getchar();
	while(code != 'Q')
		{
			switch(code)
				{
					case 'I':
 
						printf("\n\t\tInscription\n\n");
						INSCRIPTION(Tab, TI, j, pro);
						// Verifications
						printf("\nj = %d", j);
						printf("\npro = %d", pro);
						printf("\nTab[0] : %s %s", Tab[0].nom, Tab[0].prenom);
						printf("\n\nRentrez le nouveau code : ");
						code = getchar();
						break;
 
+ autres cas du switch...
 
//Fonction INSCRIPTION
 
void INSCRIPTION(struct contact Tab1[], int TI1[], int cpt, int cptPro)
{
 
	int i, k=0, IPDR;
	CH20 nomLu, prenomLu;
	CH10 telLu;
	CH5 codeCatLu;
 
 
	fflush(stdin);
	printf("Veuillez entrer le nom de la personne a ajouter dans le repertoire.\nNom : ");
	gets(nomLu);
	printf("\nVeuillez entrer son prenom.\nPrenom : ");
	gets(prenomLu);
	for(i=0; i<cpt; i=i+1)
	{
		if((strcmp(Tab1[i].nom, nomLu)==0))
		{
			if((strcmp(Tab1[i].prenom, prenomLu)==0))
			{
				IPDR=i;
				k=1;
				i=cpt-1;
			}
		}
	}
	if(k==1)
	{
		printf("Erreur. Personne deja rentree :\n\n\t");
		printf("%-25s %-25s %-15s %-10s\n\n", Tab1[IPDR].nom, Tab1[IPDR].prenom, Tab1[IPDR].tel, Tab1[IPDR].codeCat);
	}
	else
	{
		printf("\nVeuillez entrer son telephone.\nTelephone : ");
		gets(telLu);
		printf("\nVeuillez entrer sa categorie(PRO ou PERSO).\nCategorie : ");
		gets(codeCatLu);
		if((strcmp(codeCatLu, "PRO")==0)||(strcmp(codeCatLu, "PERSO")==0))
		{
			strcpy(Tab1[cpt].nom, nomLu);
			strcpy(Tab1[cpt].prenom, prenomLu);
			strcpy(Tab1[cpt].tel, telLu);
			strcpy(Tab1[cpt].codeCat, codeCatLu);
			printf("\n\nLa personne a bien ete inscrite avec les informations suivantes :");
			printf("\n\n\t%-25s %-25s %-15s %-10s\n\n", Tab1[cpt].nom, Tab1[cpt].prenom, Tab1[cpt].tel, Tab1[cpt].codeCat);
			if((strcmp(codeCatLu, "PRO")==0))     // Ajout dans TI des Pros
			{
                                  TI1[cptPro]=cpt;
                                  cptPro=cptPro+1;
            }
            cpt=cpt+1;	
		}
		else
			printf("\n\nCategorie erronee, inscription non prise en compte.\n\n");
	}
 
	system("PAUSE");
 
} | 
Partager