Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int N=4;
- string matrice[][N]={{"casa","trota","palo","lago"},
- {"amo","limo","ino","lino"},
- {"l","augurio","di","un"},
- {"buono","anno","a","tutti"}};
- void puntatore (string matrice[][N],int N);
- string concatena (string stringhe);
- int main()
- {
- puntatore(matrice,N);
- return 0;
- }
- void puntatore (string matrice[][N],int N)
- {
- int i=0,k=N-1;
- string stringa;
- while (i<N)
- {
- stringa+=concatena(matrice[i][k]);
- k--;
- i++;
- }
- cout << "Ed ecco a voi l'indirizzo della stringa "<<stringa<<":"<<&stringa;
- }
- string concatena (string stringhe)
- {
- int lunghezza=stringhe.length();
- string carattere; // la stringa inizializzata e' un carattere vuoto
- if (lunghezza%2) carattere+=stringhe[(lunghezza/2)];
- return carattere; // restituisco il carattere vuoto oppure il carattere di mezzo
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement