Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Scrivere un metodo che prenda in input una matrice bidimensionale frastagliata
- S di stringhe e restituisca la parola più lunga presente nella colonna completa
- più a destra di S (si suppone che ogni riga di S sia non vuota)*/
- # include <iostream>
- # include <string>
- using namespace std;
- string metodo (string ** S, int righe, int* colonne)
- {
- string Max="";
- int cMax=0;
- for (int j=0; j<colonne; j++)
- {
- for (int i=0; i<righe; i++)
- {
- if (S[i][j]==0)
- {
- cMax=j-1;
- }
- }
- }
- for (int i=0; i<righe; i++)
- {
- for (int j=cMax; j<colonne; j++)
- {
- if (Max<S[i][j])
- {
- Max=S[i][j];
- }
- }
- }
- return Max;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement