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
| #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
int main()
{
string mot;
int ii;
int a;
int b;
int c;
a =0;
b =0;
c =0;
int taille;
string chaine;
chaine = "abc";
taille = chaine.length();
string t1[taille];
string t2[taille];
string t3[taille];
for (ii=0; ii<taille; ii++)
{
t1[ii] = chaine.substr(ii,1);
t2[ii] = chaine.substr(ii,1);
t3[ii] = chaine.substr(ii,1);
}
while (b<taille)
{
for (a =0; a < taille; a++ )
{
cout<<t1[c] <<t2[b]<<t3[a]<<endl;
if (a == taille) // pourquoi ??? Suprimer tout ça.
{
a = 0; // a redeviendra égal à 0 lorsqu'on entrera de nouveau dans la boucle for
b++; // NE PAS SUPPRIMER, mais le sortir ça de la boucle for
break; // ...
}
}
}
system("PAUSE");
return EXIT_SUCCESS;
} |