123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #include <iostream>
- #include <string>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- string createWord()
- {
- # define VOYELLE 1
- int nbChr( rand() % 10 + 3 );
- string rep("");
- for ( int i(0); i < nbChr; i++ )
- {
- if ( rand() % 2 == VOYELLE )
- rep += "aeiouy"[rand() % 6];
- else
- rep += "bcdfghjklmnpqrstvwxz"[rand() % 20];
- }
- return rep;
- }
- int main()
- {
- srand( time(0) );
- cout << "Pointeurs sur tableau !" << endl;
- string* tab(0x0);
- int in;
- cout << "Le tableau est déjà créé mais vous pouvez choisir sa taille !" << endl;
- cin >> in;
- cout << endl << endl;
- const int mySize(in);
- tab = new string[mySize];
- for ( int i(0); i < mySize; i++ ){
- tab[i] = createWord();
- }
- for ( int i(0); i < mySize; i++ ){
- cout << i << " : " << tab[i] << endl;
- }
- //delete tab;
- return 0;
- }
|