voila mon tableau de départ:
40/50/10/00/00
00/00/60/00/60
00/00/00/90/30

la somme de chaque ligne vaut 100,120,120
la somme de chaque colonne vaut 40,50,70,90,90
en ajoutant 1 dans la case ligne 3 colonne 2 la somme de la ligne 3 vaut 121 et la somme de la colonne 2 vaut 51
je souhaite rétablir les sommes aux sommes de départ tout en remettant à zéro la case où l'on a ajouté 1.

voici ce que je veux obtenir avec mon programme:
40/49/11/00/00
00/00/59/00/61
00/00/00/90/29

et avec mon programme j'obtiens:
40/49/11/00/00
00/00/60/00/60
00/00/00/90/30

voici mon programme:
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
 
#include <stdlib.h>
#include <stdio.h>
int main()
{int j,t,k,i,cout;
int tab_qtite_dispo[3] ;
int tab_qtite_dde[5] ;
int tab_qtite[3][5];
int tab_pri[3][5];
 
tab_qtite_dde[0]=40;
tab_qtite_dde[1]=50;
tab_qtite_dde[2]=70;
tab_qtite_dde[3]=90;
tab_qtite_dde[4]=90;
 
tab_qtite_dispo[0]=100;
tab_qtite_dispo[1]=120;
tab_qtite_dispo[2]=120;
 
       tab_pri[0][0]=4   ;
       tab_pri[0][1]=1   ;
       tab_pri[0][2]=2   ;
       tab_pri[0][3]=6   ;
       tab_pri[0][4]=9   ;
 
       tab_pri[1][0]=6   ;
       tab_pri[1][1]=4   ;
       tab_pri[1][2]=3   ;
       tab_pri[1][3]=5   ;
       tab_pri[1][4]=7   ;
 
       tab_pri[2][0]=5   ;
       tab_pri[2][1]=2   ;
       tab_pri[2][2]=6   ;
       tab_pri[2][3]=4   ;
       tab_pri[2][4]=8   ; 
 
 
//printf("Plan de transport initial:\n");
//printf("\n");
 
       tab_qtite[0][0]=40  ;
       tab_qtite[0][1]=50  ;
       tab_qtite[0][2]=10  ;
       tab_qtite[0][3]=0   ;
       tab_qtite[0][4]=0   ;
 
       tab_qtite[1][0]=0   ;
       tab_qtite[1][1]=0   ;
       tab_qtite[1][2]=60  ;
       tab_qtite[1][3]=0  ;
       tab_qtite[1][4]=60   ;
 
       tab_qtite[2][0]=0    ;
       tab_qtite[2][1]=0    ;
       tab_qtite[2][2]=0    ;
       tab_qtite[2][3]=90   ;
       tab_qtite[2][4]=30   ;
 
 
tab_qtite[2][1]=1; 
 
int y,z,somme,som,ligne,colonne;
int tab_somme[3], tab_som[5];
 
somme=0;
som=0;
 
for (y=0;y<=2;y=y+1)
    {for (z=0;z<=4;z=z+1) 
     { somme=somme+tab_qtite[y][z];
     }
    tab_somme[y]=somme;
    //printf("la somme est: %d\n",tab_somme[y]);
        somme=0;
    }
for (z=0;z<=4;z=z+1)
    {for (y=0;y<=2;y=y+1) 
     { som=som+tab_qtite[y][z];
     }
    tab_som[z]=som;
    //printf("la somme est: %d\n",tab_som[z]);
        som=0;
    }
tab_qtite[2][1]=0;
 
int pas1,pas2;
 
 
 
for (y=0;y<=4;y=y+1)
{while(tab_som[y]!=tab_qtite_dde[y])
 { pas1=0;
  for (z=0;z<=2;z=z+1)
  {if(pas1==0 && tab_qtite[z][y]!=0)
   {tab_qtite[z][y]=tab_qtite[z][y]+tab_qtite_dde[y]-tab_som[y];
   tab_som[y]=tab_qtite_dde[y]; 
   pas1=pas1+1;
                                for (j=0;j<=2;j=j+1)
                                    {for (t=0;t<=4;t=t+1) 
                                         { somme=somme+tab_qtite[j][t];
                                         }
                                         tab_somme[j]=somme;
                                         somme=0;                                     
                                    }
   }     
  }
 }
}
for (z=0;z<=2;z=z+1)
{while(tab_somme[z]!=tab_qtite_dispo[z])
 { pas2=0;
  for (y=4;y>=0;y=y-1)
  {if(pas2==0 && tab_qtite[z][y]!=0)
   {tab_qtite[z][y]=tab_qtite[z][y]+tab_qtite_dispo[z]-tab_somme[z];
   tab_somme[z]=tab_qtite_dispo[z]; 
   pas2=pas2+1;
                                for (t=0;t<=4;t=t+1) 
                                    {for (j=0;j<=2;j=j+1) 
                                         { somme=somme+tab_qtite[j][t];
                                         }
                                         tab_som[t]=somme;
                                         somme=0;                                     
                                    }
   }     
  }
 }
}
 
 
 
for (j=0;j<=2;j=j+1)
{for (t=0;t<=4;t=t+1)
 {printf("Fournisseur %d au client %d: %d\n",j,t,tab_qtite[j][t]) ;
 }
}
 
 
 
 
 
 
cout=0 ;
 
for (k=0;k<=2;k=k+1)
    {for (i=0;i<=4;i=i+1)
         {cout=cout+tab_pri[k][i]*tab_qtite[k][i] ; }   
    }
 
printf("\n");
printf("Cout total = %d",cout) ;
printf("\n");
 
 
 
      system("PAUSE");
      return 0;
}
si qqun peut m'aider...