Advertisement
Guest User

Array Stringhe Casuali Beta1

a guest
Nov 26th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. int main(){
  8.     srand(time(NULL));
  9.    
  10.     int dim = rand()%4+2, dim_array = rand()%10+2, c=0, v=0, i=0, j=0, k=0, count=0;
  11.    
  12.     dim = dim*2;
  13.     cout << "Dimensione parola " << endl;
  14.     string parola[dim];
  15.     string parole_array[dim_array];
  16.     cout << "Dimensione array di parole " << parole_array << endl;
  17.     string cons[22]={"b","c","d","f","g","h","l","m","n","p","q","r","s","t","v","z","j","y","k","x","w"};
  18.     string vocali[5]=  {"a","e","i","o","u"};
  19.     string suffisso = "ba";
  20.  
  21.     while(j<dim_array){
  22.        while(i<dim){
  23.               c = rand()%22;
  24.               v = rand()%5;
  25.               parola[i] = cons[c];
  26.               parola[i+1] = vocali[v];
  27.               i = i+2;
  28.        }
  29.        parole_array[j] = parola;
  30.     }
  31.    
  32.     //cout << "La stringa ricercata risulta trovata n°" << count << " volte." << endl;
  33.     system("PAUSE");
  34.     return 1;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement