Advertisement
Gilgamesh858

vocali_Consonanti_Pari

Nov 21st, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3. #include <cstdlib>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     srand(time(NULL));
  11.     int n = ((rand() % 4) + 2) * 2;
  12.     char consonanti[16] = {'b','c','d','f','g','h','l','m','n','p','q','r','s','t','v','z'};
  13.     char vocali[5] = {'a','e','i','o','u'};
  14.     string nome[n];
  15.  
  16.     cout << endl;
  17.     for( int i = 0; i < n; i++)
  18.     {
  19.         if( i % 2 == 0 )
  20.         {
  21.             nome[i] += consonanti[rand()%16];
  22.         }
  23.         else
  24.         {
  25.             nome[i] += vocali[rand()%5];
  26.         }
  27.         cout << nome[i];
  28.     }
  29.     cout << endl << endl;
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement