Bonjour,

j'ai besoin d'aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
125
126
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 100
 
 
int bonNumero(char *numero)
{
    int okLong, okNum;
 
    okLong = strlen(numero) == 9;
    okNum = numero[0] == '7' && (numero[1] == '7' ||
                                 numero[1] == '6' ||
                                 numero[1] == '0' ||
                                 numero[1] == '8');
 
    if (!okLong && okNum)
        printf("Le numero doit comporter 9 chiffres\n");
    if (!okLong && !okNum)
        printf("Le numero doit comporter 9 chiffres et commence par 77 ou 76 ou 70 ou 78\n");
    if (okLong && !okNum)
        printf("Le nummero doit commencer par : 77 ou 76 ou 70 ou 78\n");
 
    return okNum && okLong; 
}
 
int bonNumerocorres(char *numerocorres)
{
    int i, oknumcorres = 0;
    int preO = 5, preT = 5, preE = 5;
    int ind1, ind2, ind3;
    int mat[3][N] ={{772314440, 782314440, 774517070, 784517070, 778868181},
                    {762314440, 764517070, 768868181, 763570521, 765181304}, 
                    {702314440, 704517070, 708868181, 703570521, 705181304}};
    char numero[30];
 
 
    if (oknumcorres == numero)
        printf("Le numero du correspondant doit etre different de votre numero\n");
    if (ind1 == 77 || ind1 == 78)
    {
        for (i = 0; i <= preO; i++)
        {
            if (mat[0][i] == numero)
            {
            oknumcorres = 1;
            i = preO;
            }
        }
        if (oknumcorres == 0)
        printf("Ce numero n'est pas enregistre\n");
    }
    if (ind1 == 76)
    {
        for (i = 0; i <= preT; i++)
        {
            if (mat[1][i] == numero)
            {
            oknumcorres = 1;
            i = preT;
            }
        }
        if (oknumcorres == 0)
        printf("Ce numero n'est pas enregistre\n");
    }
    if (ind1 == 70)
    {
        for (i = 0; i <= preE; i++)
        {
            if (mat[2][i] == numero)
            {
            oknumcorres = 1;
            i = preE;
            }
        }
        if (oknumcorres == 0)
        printf("Ce numero n'est pas enregistre\n");
    }
 
    return oknumcorres;
}
 
 
int main()
{
    int credit, dureecomsouhaite;
    char numero[30], numerocorres[30];
 
    do 
    {
        printf("Entrer votre numero\n");
        scanf("%s", &numero);
    }
    while (!bonNumero(numero));
 
    do
    {
        printf("Entrer le montant de votre credit\n");
        scanf("%d",&credit);
 
        if (credit < 60)
            printf("Le credit doit etre superieur ou egale a 60\n");
    }
    while (credit < 60);
 
    do
    {
        printf("Entrer le numero du correspondant\n");
        scanf("%s", &numerocorres);
    }
    while (!bonNumero(numerocorres) || !bonNumerocorres(numerocorres));
 
    do
    {
        printf("Entrer la duree de communication souhaitee\n");
        scanf("%d", &dureecomsouhaite);    
    }
    while (dureecomsouhaite < 0);
 
 
 
 
 
    return 0;
}
Merci d'avance.