IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

SL & STL C++ Discussion :

Bug renvoi tableau


Sujet :

SL & STL C++

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2008
    Messages
    11
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Mai 2008
    Messages : 11
    Points : 6
    Points
    6
    Par défaut Bug renvoi tableau
    Bonjour tout le monde,

    voilà, je suis confronté à un bug incompréhensible dans mon programme.
    Je fais appel à une fonction qui renvoie un objet tab_resultats de type vector < vector < vector < string > > >.
    J'ai testé l'exécution de la fonction en mode debug et tout fonctionne bien, l'objet en question est correctement rempli. Mais lors du renvoi de cet objet tab_resultats, le programme s'arrête brutalement.

    Pour info, l'objet recevant ce qui est retourné par la fonction est bien du même type que tab_resultats donc l'erreur ne vient pas de là.

    On pourrait aussi penser qu'il s'agit d'un problème de mémoire parce que le type de l'objet tab_resultats est assez lourd, et que la fonction a pas moins de 10 paramètres (passés par référence cependant). Mais mon programme tournait très bien auparavant, et le niveau d'utilisation de l'UC donné par le gestionnaire des tâches reste tt a fait raisonnable.

    Donc bon voilà, je suis assez démuni...

    Merci d'essayer de m'aider

    PS : j'utilise DEV-C++ comme environnement de développement
    Le fichier exécutable est de grande taille aussi, environ 4 Mo. Peut etre celà influe-t-il.

  2. #2
    Rédacteur

    Avatar de Davidbrcz
    Homme Profil pro
    Ing Supaéro - Doctorant ONERA
    Inscrit en
    Juin 2006
    Messages
    2 307
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 32
    Localisation : Suisse

    Informations professionnelles :
    Activité : Ing Supaéro - Doctorant ONERA

    Informations forums :
    Inscription : Juin 2006
    Messages : 2 307
    Points : 4 732
    Points
    4 732
    Par défaut
    Le plugin Boule de Cristal est inactif, (comprendre, montre nous ton code).

    Sinon que donne gdb ?
    "Never use brute force in fighting an exponential." (Andrei Alexandrescu)

    Mes articles dont Conseils divers sur le C++
    Une très bonne doc sur le C++ (en) Why linux is better (fr)

  3. #3
    Membre expert
    Avatar de Klaim
    Homme Profil pro
    Développeur de jeux vidéo
    Inscrit en
    Août 2004
    Messages
    1 717
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur de jeux vidéo
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2004
    Messages : 1 717
    Points : 3 344
    Points
    3 344
    Par défaut
    le programme s'arrête brutalement.
    Le message d'erreur (au debug) serait utile aussi. (Sauf si yen a pas auquel cas tu es dans une boucle infini ou un deadlock).

    PS : j'utilise DEV-C++ comme environnement de développement
    Les autres confirmeront ou pas, mais il me semble qu'il est pas mal déconseillé parceque buggé (peut être pas la dernière version?). T'es obligé de l'utiliser?


    Le fichier exécutable est de grande taille aussi, environ 4 Mo.
    Je ne sais pas sur quoi est censé tourner ton application, mais ce n'est pas ce que j'appelle une "grande" taille Enfin ça dépends...

  4. #4
    Rédacteur

    Avatar de Davidbrcz
    Homme Profil pro
    Ing Supaéro - Doctorant ONERA
    Inscrit en
    Juin 2006
    Messages
    2 307
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 32
    Localisation : Suisse

    Informations professionnelles :
    Activité : Ing Supaéro - Doctorant ONERA

    Informations forums :
    Inscription : Juin 2006
    Messages : 2 307
    Points : 4 732
    Points
    4 732
    Par défaut
    Les autres confirmeront ou pas, mais il me semble qu'il est pas mal déconseillé parceque buggé (peut être pas la dernière version?). T'es obligé de l'utiliser?
    Y'a plus de dernière version, le projet est mort .
    On conseille souvent de passer à CodeBlocks à la place
    "Never use brute force in fighting an exponential." (Andrei Alexandrescu)

    Mes articles dont Conseils divers sur le C++
    Une très bonne doc sur le C++ (en) Why linux is better (fr)

  5. #5
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2008
    Messages
    11
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Mai 2008
    Messages : 11
    Points : 6
    Points
    6
    Par défaut
    disons que si je poste le code, y en a pour plus de 1000 lignes...
    Après, il n'y a pas de message d'erreur justement, l'exécution s'arrête brutalement, sans raison me semble-t-il. Comme j'ai dit, le tableau renvoyé est correctement rempli donc la fonction s'exécute correctement. De plus, mon programme tournait bien auparavant donc çà ressemble bien à un bug de dev c++.
    Je vous posterai des extraits de code un peu plus tard mais à priori y a pas d'erreur.

  6. #6
    yan
    yan est déconnecté
    Rédacteur
    Avatar de yan
    Homme Profil pro
    Ingénieur expert
    Inscrit en
    Mars 2004
    Messages
    10 033
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Ingénieur expert
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2004
    Messages : 10 033
    Points : 13 968
    Points
    13 968
    Par défaut
    Citation Envoyé par gaze24 Voir le message
    disons que si je poste le code, y en a pour plus de 1000 lignes...
    Après, il n'y a pas de message d'erreur justement, l'exécution s'arrête brutalement, sans raison me semble-t-il. Comme j'ai dit, le tableau renvoyé est correctement rempli donc la fonction s'exécute correctement. De plus, mon programme tournait bien auparavant donc çà ressemble bien à un bug de dev c++.
    dev c++ n'est qu'une ide. Elle ne peut créé un bug comme celui là.

  7. #7
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2008
    Messages
    11
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Mai 2008
    Messages : 11
    Points : 6
    Points
    6
    Par défaut
    j'ai essayer de faire tourner mon programme sous Code::Blocks et là j'ai ce message qui s'affiche au débogage, au moment du renvoi du tableau :

    Program received signal SIGTRAP, Trace/breakpoint trap.
    In _libmsvcrt_a_iname () ()


    et en l'exécutant directement, j'ai ce message là :

    Process terminated with status -1073741819 (0 minutes, 6 seconds)

    Je vous poste des extraits de mon code, ici la partie juste avant l'appel de la fonction

    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
     
                     istringstream flux1(tab_part_LT[i]);
                     flux1 >> temp_float1;
                     istringstream flux2(tab_part_CT[i]);
                     flux2 >> temp_float2;
     
                     if (tab_part_CDC_bis[i] == "null")
                     {
                         tab_parts.push_back (temp_float1/100);
                         tab_parts.push_back (temp_float2/100);
                     }
                     else
                     {
                         temp = tab_part_CDC_bis[i];
                         istringstream flux3(temp);
                         flux3 >> temp_float3;
                         temp.clear();
                         tab_parts.push_back ((1 - temp_float3/100)*(temp_float1/100));
                         tab_parts.push_back ((1 - temp_float3/100)*(temp_float2/100));
                         tab_parts.push_back (temp_float3/100);
                     }
     
                     k = 0; cout << tab_noms[i] << endl;
                     temp = tab_noms[i];
                     if (tab_noms[i] == "LIVRETS")
                         temp = "CSL";
                     while (tab_taux_bis[k].getNom().find (temp) == string::npos)
                           ++k;
                     tab_val_taux = tab_taux_bis[k].getTab_taux();
                     //tab_date_temp = tab_taux_bis[k].getTab_temps();
     
                     k = 0;
                     while (tab_produits[k].getNom().find (tab_noms[i]) == string::npos)
                           ++k;
                     tab_encours_temp = tab_produits[k].getEncours();
                     //tab_val_encours.clear();
                     //cout << tab_encours_temp.size() << endl;
                     for (j = 0; j < tab_encours_temp.size(); ++j)
                     {
                         //cout << tab_encours_temp[j].size() << endl;
                         for (int m = 0; m < tab_encours_temp[j].size(); ++m)
                         {
                             //cout << tab_encours_temp[j][m] << " ";
                             tab_val_encours.push_back(tab_encours_temp[j][m]);
                             //cout << tab_val_encours.back() << " ";
                         }
                     }
                     //cout << endl;
     
                     temp = tab_mois_fixing[i];
                     istringstream flux1(temp);
                     flux1 >> temp_mois_fixing;
                     temp.clear();
     
                     temp = tab_mois_appl[i];
                     istringstream flux2(temp);
                     flux2 >> temp_mois_appl;
                     temp.clear();
     
                     temp = tab_perio_fixing[i];
                     istringstream flux3(temp);
                     flux3 >> temp_perio_fixing;
                     temp.clear();
     
                     // "retailler" les tableaux obtenus pour les faire coller à tab_date_modif[i]
     
                     tab_date_temp = tab_date_modif[i];
                     cout << tab_date_temp.front();
     
                     diff = tab_val_encours.size() - tab_date_modif[i].size();
                     tab_val_encours.erase (tab_val_encours.begin(), tab_val_encours.begin() + diff);
     
                     diff = tab_val_taux.size() - tab_date_modif[i].size();
                     tab_val_taux.erase (tab_val_taux.begin(), tab_val_taux.begin() + diff);
     
     
                     resultats_refixing = refixing_TLA_bis (tab_noms[i], tab_parts, tab_val_encours,
                     temp_mois_fixing, temp_mois_appl, temp_perio_fixing, tab_val_taux, tab_date_temp,
                     tab_marge_client[i], tab_tx_marge_prod[i]);
    voici les types de parametre et de renvoi de la fonction refixing_TLA_bis :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    vector < vector < vector < string > > > refixing_TLA_bis (const string& nom, const vector < float >& tab_parts,
     vector < float >& tab_encours, const int& mois_refix, const int& mois_application, const int& perio_fixing,
     vector < float >& tab_val_index, const vector < string >& tab_temps_modif, const vector < string >& marge_client, const vector < string >& marge_prod)
    et enfin le code de la fonction :

    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
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    vector < vector < vector < string > > > refixing_TLA_bis (const string& nom, const vector < float >& tab_parts,
     vector < float >& tab_encours, const int& mois_refix, const int& mois_application, const int& perio_fixing,
     vector < float >& tab_val_index, const vector < string >& tab_temps_modif, vector < string >& marge_client, vector < string >& marge_prod)
    {
     int j, k, diff, indice, indice_refix;
     int num_mois, delta_fixing, delta_appl, delta;
     string temp;
     float temp_float;
     int temp_int;
     int taille = tab_temps_modif.size();
     
     // si on ajoute segment _CT int nb_objets = 2 * (perio_fixing + 1) + 2;
     
     int nb_objets = 2 * (perio_fixing + 1) + 1;
     
     //vector < int > tab_delta;
     vector < string > tab_mois_fixing;
     vector < int > tab_premier_fixing;
     
     vector < string > tab_cle;
     vector < float > tab_marge_client, tab_encours_CT;
     
     vector < vector < float > > tab_encours_simu (nb_objets), tab_tx_client_simu (nb_objets), tab_marge_prod_simu (nb_objets);
     vector < float > tab_val_encours, tab_tx_client, tab_marge_prod;
     
     vector < vector < string > > tab_cle_simu, tab_temps_simu, tab_encours_simu_str (nb_objets),
                                  tab_tx_client_simu_str (nb_objets), tab_marge_prod_simu_str (nb_objets);
     
     vector < vector < vector < string > > > tab_resultats;
     
     /*diff = tab_encours.size() - tab_temps_modif.size();
     tab_encours.erase (tab_encours.begin(), tab_encours.begin() + diff);
     
     diff = tab_val_index.size() - tab_temps_modif.size();
     tab_val_index.erase (tab_val_index.begin(), tab_val_index.begin() + diff);*/
     //cout << tab_encours.size() << " " << tab_val_index.size() << " " << tab_temps_modif.size() << endl;
     // remplissage du tableau des noms
     temp = nom;
     temp += "_LT";
     tab_cle.push_back (temp); //cout << tab_cle.back() << " ";
     temp.clear();
     
     temp = nom;
     temp += "_CT_init_A";
     tab_cle.push_back (temp); //cout << tab_cle.back() << " ";
     temp.clear();
     
     for (int i = 1; i < perio_fixing + 1; ++i)
     {
         temp = nom;
         ostringstream oss;
         oss << i;
         temp += "_CT_";
         temp += oss.str();
         temp += "_A";
         tab_cle.push_back (temp); //cout << tab_cle.back() << " ";
         temp.clear();
     }
     
     temp = nom;
     temp += "_CT_init_B";
     tab_cle.push_back (temp); //cout << tab_cle.back() << " ";
     temp.clear();
     
     for (int i = 1; i < perio_fixing + 1; ++i)
     {
         temp = nom;
         ostringstream oss;
         oss << i;
         temp += "_CT_";
         temp += oss.str();
         temp += "_B";
         tab_cle.push_back (temp); //cout << tab_cle.back() << " ";
         temp.clear();
     }
     
     // ajout éventuel d'un segment _CT
     /*
     temp = nom;
     temp += "_CT";
     tab_cle.push_back (temp); //cout << tab_cle.back() << " ";
     temp.clear();
     */
     
     for (int i = 0; i < marge_client.size(); ++i)
     {
         if ((temp = marge_client[i]) != "null")
         {
             istringstream flux(temp);
             flux >> temp_float; //cout << temp_float << " ";
             k = 0;
             while (k < 12)
             {
                 tab_marge_client.push_back (temp_float);
                 ++k;
             }
         }
     }
     //cout << endl;
     
     if (tab_marge_client.size() > taille)
     {
         diff = tab_marge_client.size() - taille; cout << diff << endl;
         tab_marge_client.erase (tab_marge_client.begin(), tab_marge_client.begin() + diff);
     }
     
     if (marge_prod.size() > 0)
     {
         for (int i = 0; i < marge_prod.size(); ++i)
         {
             if ((temp = marge_prod[i]) != "null")
             {
                 istringstream flux(temp);
                 flux >> temp_float; //cout << temp_float << " ";
                 k = 0;
                 while (k < 12)
                 {
                     tab_marge_prod.push_back (temp_float);
                     ++k;
                 }
             }
         }
     
         if (tab_marge_prod.size() > taille)
         {
             diff = tab_marge_prod.size() - taille; cout << diff << endl;
             tab_marge_prod.erase (tab_marge_prod.begin(), tab_marge_prod.begin() + diff);
         }
     
         for (int i = 0; i < nb_objets; ++i)
             tab_marge_prod_simu.push_back (tab_marge_prod); // le tableau de marge_prod est rempli pour tous les objets
     }
     //cout << endl;
     //traitement cas LT
     
     for (int i = 0; i < taille; ++i) {
         tab_val_encours.push_back (tab_encours[i] * tab_parts[0]);
         //cout << tab_encours[i] << " " << tab_parts[0] << " ";
     }
     //cout << endl;
     tab_encours_simu[0] = tab_val_encours;
     tab_val_encours.assign (tab_encours.size(), 0);
     fill (tab_encours_simu.begin() + 1, tab_encours_simu.end(), tab_val_encours);
     tab_val_encours.clear();
     
     for (int i = 0; i < taille; ++i) {
         tab_encours_CT.push_back (tab_encours[i] * tab_parts[1]); // tab_val_encours rempli par la part CT
         //cout << tab_encours[i] << " " << tab_parts[1] << " ";
     }
     //cout << endl;
     
     for (int i = 0; i < tab_marge_client.size(); ++i)
     {
         if (tab_marge_client.size() > 0)
             tab_tx_client.push_back (tab_val_index[i] - tab_marge_client[i]);
         else
             tab_tx_client.push_back (tab_val_index[i]);
     }
     
     for (int i = 0; i < nb_objets; ++i)
     {
         //if ((i != 1) && (i != perio_fixing + 2))
             tab_tx_client_simu[i] = tab_tx_client; // tableau de taux_client ajouté pour toutes les parts sauf celles d'init
     
         /*else
             tab_tx_client_simu[i].resize(tab_tx_client.size());*/
     }
     //tab_tx_client.clear();
     
     // fin traitement cas LT
     // création des différents produits du refixing
     
     // construction du tableau de delta pour parcourir le temps
     
     // trouver autres mois de fixing que celui indiqué
     num_mois = mois_refix;
     do
     {
         num_mois = num_mois + perio_fixing;
         if (num_mois > 12)
             num_mois = num_mois - 12;
         ostringstream oss;
         oss << num_mois;
         if (num_mois < 10)
             temp = "01/0";
         else
             temp = "01/";
     
         temp += oss.str(); //cout << temp << endl;
         tab_mois_fixing.push_back (temp);
     }
     while (num_mois != mois_refix);
     
     // boucle de refixing
     // on recherche d'abord le premier mois de refixing
     //cout << tab_temps_modif.size() << " " << tab_mois_fixing.size() << endl;
     for (int i = 0; i < tab_mois_fixing.size(); ++i)
     {
         k = 0;
         while (tab_temps_modif[k].find (tab_mois_fixing[i]) == string::npos)
               ++k;
         tab_premier_fixing.push_back (k);
     }
     
     //traitement avant le premier refixing si celui-ci est différent de la première date considérée
     sort (tab_premier_fixing.begin(), tab_premier_fixing.end());
     
     if (mois_application < mois_refix)
         diff = 12 + mois_application - mois_refix;
     else
         diff = mois_application - mois_refix;
     
     delta_fixing = tab_premier_fixing.front();
     delta_appl = delta_fixing + diff;
     delta = 0;
     //cout << delta << " " << delta_fixing << " " << delta_appl << " " << diff << endl;
     if (delta_fixing != 0)
     {
         // on commence par remplir les produits d'indice B, pour reprendre ensuite le cycle normal
         j = delta;
         while(j < delta_appl)
         {
             while (j < delta + diff)
             {
                 tab_encours_simu[perio_fixing + 2][j] = tab_encours_CT[delta];
                 //tab_tx_client_simu[perio_fixing + 2][j] = tab_tx_client[delta];
                 //cout << tab_tx_client_simu[perio_fixing + 2][j] << " ";
                 ++j;
             }
             tab_encours_simu[perio_fixing + 2][j] = tab_encours_CT[delta];
             //cout << tab_cle[perio_fixing + 2] << " " << tab_encours_simu[perio_fixing + 2][j] << " " << tab_tx_client_simu[perio_fixing + 2][j] << endl;
             //tab_tx_client_simu[perio_fixing + 2][j] = tab_tx_client[delta];
             ++j;
         }
         ++delta;
     
         while (delta < delta_fixing)
         {
             indice = delta - delta_fixing + 2*perio_fixing + 3;
             temp_float = tab_encours_CT[delta] - tab_encours_CT[delta - 1]; //cout << tab_encours_CT[delta] << " " << tab_encours_CT[delta - 1] << " " << temp_float << endl;
             // à modifier : faire temp_float = tab_encours_CT[delta] * gabarit [0] - tab_encours_CT[delta - 1] * gabarit [1];
             // mais ici, avec gabarit in fine, on peut faire des deux façons
             for (j = delta; j < delta_appl; ++j)
             {
                 tab_encours_simu[indice][j] = temp_float; //cout << tab_cle[indice] << " ";
                 //tab_tx_client_simu[indice][j] = tab_tx_client[j]; cout << tab_tx_client_simu[indice][j] << " ";
             }
             ++delta;
         }
     }
     
     delta_fixing = delta_fixing + perio_fixing;
     //cout << endl;
     while (delta_fixing < taille)
     {
         // part A des sous-produits
         delta_appl = delta_fixing + diff;
         //cout << delta_fixing << " " << delta_appl << " " << delta << endl;
         while (delta < delta_fixing)
         {
             if (delta == delta_fixing - perio_fixing)
             {
                 j = delta;
                 while ((j < delta_appl) && (j < taille))
                 {
                     while (j < delta + diff)
                     {
                         if (delta > 0)
                             tab_tx_client_simu[1][j] = 60*tab_tx_client[delta] / (60 + tab_tx_client[delta - 1]);
                         else
                             tab_tx_client_simu[1][j] = tab_tx_client[delta];
                         //cout << tab_tx_client_simu[1][j] << " ";
                         ++j;
                     }
                     //cout << endl;
                     if (delta > 0)
                     {
                         tab_encours_simu[1][j] = tab_encours_CT[delta - 1];
                         tab_tx_client_simu[1][j] = 60*tab_tx_client[delta] / (60 + tab_tx_client[delta - 1]);
                     }
                     else
                     {
                         tab_encours_simu[1][j] = tab_encours_CT[delta];
                         tab_tx_client_simu[1][j] = tab_tx_client[delta];
                     }
                     //tab_tx_client_simu[1][j] = tab_tx_client[delta]; cout << tab_tx_client_simu[1][j] << " ";
                     //cout << tab_tx_client_simu[1][j] << " ";
                     ++j;
                 }
                 //cout << endl;
             }
     
             indice = delta - delta_fixing + perio_fixing + 2;
             if (delta > 0)
             {
                 temp_float = tab_encours_CT[delta] - tab_encours_CT[delta - 1];
                 j = delta;
     
                 while ((j < delta_appl) && (j < taille))
                 {
                     tab_encours_simu[indice][j] = temp_float;
                     //tab_tx_client_simu[indice][j] = tab_tx_client[j];
                     ++j;
                 }
             }
             ++delta;
         }
     
         // part B des sous-produits
         delta_fixing = delta_fixing + perio_fixing;
         delta_appl = delta_fixing + diff;
     
         while ((delta < delta_fixing) && (delta_fixing < taille))
         {
             if (delta == delta_fixing - perio_fixing)
             {
                 j = delta;
                 while ((j < delta_appl) && (j < taille))
                 {
                     while (j < delta + diff)
                     {
                         tab_tx_client_simu[perio_fixing + 2][j] = 60*tab_tx_client[delta] / (60 + tab_tx_client[delta - 1]);
                         ++j;
                     }
                     tab_encours_simu[perio_fixing + 2][j] = tab_encours_CT[delta - 1];
                     tab_tx_client_simu[perio_fixing + 2][j] = 60*tab_tx_client[delta] / (60 + tab_tx_client[delta - 1]);
                     ++j;
                 }
             }
             indice = delta - delta_fixing + 2*perio_fixing + 3;
             temp_float = tab_encours_CT[delta] - tab_encours_CT[delta - 1];
             j = delta;
     
             while ((j < delta_appl) && (j < taille))
             {
                 tab_encours_simu[indice][j] = temp_float;
                 //tab_tx_client_simu[indice][j] = tab_tx_client[j];
                 ++j;
             }
             ++delta;
         }
         delta_fixing = delta_fixing + perio_fixing;
     }
     
     // pour fin du tableau, voir ou se situe indice pour déterminer ce que l'on remplit
     if (indice > perio_fixing + 2)
     {
         indice_refix = 1;
         indice = delta - delta_fixing + perio_fixing + 2;
     }
     else
     {
         indice_refix = perio_fixing + 2;
         indice = delta - delta_fixing + 2*perio_fixing + 3;
     }
     
     while (delta < taille)
     {
         if (delta == delta_fixing - perio_fixing)
         {
             j = delta;
             while (j < taille)
             {
                 while ((j < delta + diff) && (j < taille))
                 {
                     tab_tx_client_simu[indice_refix][j] = 60*tab_tx_client[delta] / (60 + tab_tx_client[delta - 1]);
                     ++j;
                 }
                 tab_encours_simu[indice_refix][j] = tab_encours_CT[delta - 1];
                 //tab_tx_client_simu[indice_refix][j] = tab_tx_client[delta];
                 /* ou bien (forward 2 mois) : */
                 tab_tx_client_simu[indice_refix][j] = 60*tab_tx_client[delta] / (60 + tab_tx_client[delta - 1]);
                 ++j;
             }
         }
     
         temp_float = tab_encours_CT[delta] - tab_encours_CT[delta - 1];
         j = delta;
     
         while (j < taille)
         {
             tab_encours_simu[indice][j] = temp_float;
             //tab_tx_client_simu[indice][j] = tab_tx_client[j];
             ++j;
         }
         ++delta;
         ++indice;
     }
     
     // ajout d'un segment _CT dont l'encours est la somme des sous-segments _CT_*
     /*
     for (j = 0; j < taille; ++j)
     {
         tab_tx_client_simu[nb_objets - 1][j] = tab_tx_client_simu[0][j];
         tab_encours_simu[nb_objets - 1][j] = 0;
         for (int i = 1; i < nb_objets - 1; ++i)
         {
             tab_encours_simu[nb_objets - 1][j] = tab_encours_simu[nb_objets - 1][j] + tab_encours_simu[i][j];
         }
     }
     */
     
     //enfin, on transforme les tableaux de float en tableaux de string pour pouvoir les renvoyer
     //tab_cle   tab_temps_modif         tab_encours_simu       tab_tx_client_simu      tab_marge_prod_simu
     //cout << nb_objets << " " << tab_encours_simu.size() << endl;
     for (int i = 0; i < nb_objets; ++i)
     {
         cout << endl << tab_cle[i] << endl;
         for (j = 0; j < taille; ++j)
         {
             ostringstream oss1, oss2, oss3;
             oss1 << tab_encours_simu[i][j];
             oss2 << tab_tx_client_simu[i][j];
             cout << tab_encours_simu[i][j] << " " << tab_tx_client_simu[i][j] << " ";
             temp = oss1.str();
             tab_encours_simu_str[i].push_back (temp); cout << tab_encours_simu_str[i].back() << " ";
             temp = oss2.str();
             tab_tx_client_simu_str[i].push_back (temp); cout << tab_tx_client_simu_str[i].back() << " ";
     
             if (j < tab_marge_prod_simu[i].size())
             {
                oss3 << tab_marge_prod_simu[i][j];
                temp = oss3.str();
                cout << tab_marge_prod_simu[i][j] << " " << temp << " ";
                tab_marge_prod_simu_str[i].push_back (temp);
             }
         }
         cout << endl;
     }
     
     tab_cle_simu.push_back (tab_cle);
     //tab_temps_simu.push_back(tab_temps_modif);
     cout << taille << " " << tab_encours_simu[0].size() << " " << tab_tx_client_simu[0].size() << " " << tab_marge_prod_simu[0].size() << endl;
     
     tab_resultats.push_back (tab_cle_simu);
     //tab_resultats.push_back (tab_temps_simu);
     tab_resultats.push_back (tab_encours_simu_str);
     tab_resultats.push_back (tab_tx_client_simu_str);
     tab_resultats.push_back (tab_marge_prod_simu_str);
     cout << tab_resultats.size() << endl;
     
     return tab_resultats;
    }

  8. #8
    Membre éprouvé
    Avatar de Spout
    Profil pro
    Ingénieur systèmes et réseaux
    Inscrit en
    Février 2007
    Messages
    904
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France, Val d'Oise (Île de France)

    Informations professionnelles :
    Activité : Ingénieur systèmes et réseaux

    Informations forums :
    Inscription : Février 2007
    Messages : 904
    Points : 1 067
    Points
    1 067
    Par défaut
    Conseil: mets des traces dans ton code pour savoir à quel endroit le programme se termine.
    "L'ordinateur obéit à vos ordres, pas à vos intentions." [Anonyme]

Discussions similaires

  1. Etrange bug de tableau
    Par anthonyplay dans le forum Débuter
    Réponses: 10
    Dernier message: 29/11/2009, 15h41
  2. [Tableaux] Renvoi tableau
    Par developman dans le forum Langage
    Réponses: 1
    Dernier message: 19/03/2007, 17h14
  3. Bug Firefox sur tableau centré dans un div (mauvais refresh)
    Par FrankOVD dans le forum Balisage (X)HTML et validation W3C
    Réponses: 3
    Dernier message: 04/07/2005, 17h47
  4. [XHTML] centrer un tableau au milieu d'un div - bug firefox
    Par mondiani dans le forum Balisage (X)HTML et validation W3C
    Réponses: 5
    Dernier message: 07/02/2005, 23h57

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo