Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime> // srand
- #include <cstdlib> // srand
- #include <iomanip> // setw
- using namespace std;
- int main()
- {
- int righe,colonne,i=0,j=0,k=0,lunghezza_stringa,l,m;
- string confronto="aeiou";
- l=confronto.length();
- cout << "Indicare la grandezza della matrice di stringhe.\n";
- cout << "Righe :";
- cin >> righe;
- cout << "Colonne :";
- cin >> colonne;
- cout << "Lunghezza stringa :";
- cin >> lunghezza_stringa;
- string matrice[righe][colonne];
- srand(time(0));
- // inizializzo matrice
- while (i<righe)
- {
- j=0;
- while (j<colonne)
- {
- k=0;
- while (k<lunghezza_stringa)
- {
- matrice[i][j]+=char(rand()%26+97);
- k++;
- }
- cout << matrice[i][j] << " ";
- j++;
- }
- cout << "\n";
- i++;
- }
- // ricerca delle vocali nelle stringhe
- i=0;
- while (i<righe)
- {
- j=0;
- while (j<colonne)
- {
- k=0;
- while (k<lunghezza_stringa)
- {
- m=0;
- while (m<l)
- {
- if (matrice[i][j][k]==confronto[m]) cout << confronto[m];
- m++;
- }
- k++;
- }
- j++;
- }
- i++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement