- Codice: Seleziona tutto
bool palindroma (char*s)
{
c = lunghezza stringa-1;
d = lunghezza stringa-1;
int i=0;
while (s[c]==s[i])
{
i++;
c--;
if (i==d && c==0)
return true;
else return false;
}
}
bool palindroma (char*s)
{
c = lunghezza stringa-1;
d = lunghezza stringa-1;
int i=0;
while (s[c]==s[i])
{
i++;
c--;
if (i==d && c==0)
return true;
else return false;
}
}
bool palindroma (char*s)
{
c = lunghezza stringa-1;
d = lunghezza stringa-1;
int i=0;
while (s[c]==s[i])
{
i++;
c--;
if (i==d && c==0)
return true;
else return false;
}
}
Private Sub Pulsante_Click()
If (Len(Text1.Text) Mod 2) = 0 Then GoTo 100 <font color="green">'Se è pari la escludiamo subito!</font id="green">
For k = 1 To (Len(Text1.Text) - 1) / 2
If Mid(UCase(Text1.Text), (Len(Text1.Text) - 1) / 2 + 1 + k, 1) <> Mid(UCase(Text1.Text), (Len(Text1.Text) - 1) / 2 + 1 - k, 1) Then GoTo 100
Next k
MsgBox "È Palindroma!!!!!": Exit Sub
100 MsgBox ("Non è palindroma!!!")
End Sub
bool palindroma (char*s)
{
c = lunghezza stringa-1;
d = lunghezza stringa-1;
int i=0;
while (s[c]==s[i])
{
i++;
c--;
if (i==d && c==0)
return true;
else return false;
}
}
Private Sub Pulsante_Click()
Palindroma = False <font color="green">'La riazzero casomai non fosse la prima verifica...</font id="green">
<b>For k = 0 To Len(A) / 2
If Mid(A, k + 1, 1) <> Mid(A, Len(A) - k, 1) Then Palindroma = False: GoTo 10
Next k
Palindroma = True</b>
10 MsgBox (Palindroma)
End Sub
Visitano il forum: Nessuno e 1 ospite
megalab.it: testata telematica quotidiana registrata al Tribunale di Cosenza n. 22/09 del 13.08.2009, editore Master New Media S.r.l.; © Copyright 2008 Master New Media S.r.l. a socio unico - P.I. 02947530784. GRUPPO EDIZIONI MASTER Spa Tutti i diritti sono riservati. Per la pubblicità: Master Advertising