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
|
-------------------------
//main
-------------------------
int main()
{
int ip1=0, ip2=0, ip3=0, ip4=0;
int ma1=0, ma2=0, ma3=0, ma4=0;
int classe=0, test=0, bol=0;
entreeIp(&ip1, &ip2, &ip3, &ip4);
testeurClasse(&classe, ip1);
entreeMa(&ma1,&ma2,&ma3,&ma4,classe);
printf("\n\n");
printf("L'ip est le :\t\t\t\t%i.%i.%i.%i\n", ip1, ip2, ip3, ip4);
printf("Le masque de sous-reseau est:\t\t%i.%i.%i.%i\n\n", ma1, ma2, ma3, ma4);
trouverAdresseReseau(classe, ip1, ip2, ip3, ip4);
trouverAdresseUtilisateur(classe ,ip1 ,ip2 ,ip3 ,ip4);
printf("\n");
numeroSousReseau(ma2, ma3, ma4, ip2, ip3, ip4);
printf("\n");
nbrsPc(ma1, ma2, ma3, ma4);
compterSousReseau(ma2, ma3, ma4);//sa bloque ici
system("pause");
return 0;
-------------------------------------------
// la fonction juste avant l'appel qui bloque
-------------------------------------------
void nbrsPc (int ma1,int ma2,int ma3,int ma4){
int nbrspc=1;
nbrspc*=compterPc(ma1);
nbrspc*=compterPc(ma2);
nbrspc*=compterPc(ma3);
nbrspc*=compterPc(ma4);
printf("Le nombre d'ordinateur possible est :\t %i\n", nbrspc);
}
-----------------------------------------
//la fonction qui bloque
-----------------------------------------
{
int total=0, i=0;
if (ma2!=255 && ma2!=0){
total+=nbrsSousReseau(ma2);
}else if (ma3!=255 && ma3!=0){
total+=nbrsSousReseau(ma3);
}else if (ma4!=255 && ma4!=0){
total+=nbrsSousReseau(ma4);
}
for (i=1; 1<=8; i++){
if (total==i){
total=pow(2.0,i);
}
}
printf("Le nombres de sous-reseau possible est:\t %i\n", total);
}
--------------------------------------
} |
Partager