Abc

Abc


Ecco un esempio di funzione in C++ che può risolvere il problema:


```c++

#include <iostream>

#include <string>

using namespace std;


int confrontaStringhe(string s1, string s2) {

if (s1 == s2) {

return 0;

} else {

return s1.length() + s2.length();

}

}


int main() {

string str1 = "ciao";

string str2 = "ciao";

int risultato = confrontaStringhe(str1, str2);

cout << risultato << endl;

return 0;

}

```


Questa funzione prende in input due stringhe e confronta se sono uguali. Se lo sono, ritorna 0. Altrimenti, ritorna la somma delle lunghezze delle due stringhe. Spero che questo ti aiuti! 😊

Report Page