Tags:
create new tag
view all tags

Soluzione Homework 1

*Le soluzioni presenti in questa pagina sono state prese dal documento della Prof.ssa Chiara Petrioli, esercitatore del canale A-D*
Il documento da cui sono state prese le soluzioni si trova su:
http://twiki.dsi.uniroma1.it/twiki/view/Es_prog2/DomandeHomeworkUno

Funzione: int contamaiuscole (char *)

int contamaiuscole (char *s1)
{
if (*s1 != ‘\0’)
return (((*s1>=‘A’)&&(*s1<=‘Z’))?1 + contamaiuscole (s1+1): contamaiuscole (s1+1));
else
return 0;
}

Funzione: int maxprefissocomune (char *, char *)

int maxprefissocomune (char *s1, char *s2)
{
if ((*s1 == *s2) && (*s1 != ‘\0’))
return (1+maxprefissocomune (s1+1,s2+1));
else
return 0;
}

Funzione: int solecifre (char *)

int solecifre (char *s1)
{
if ((*s1 == ‘\0’))
return 1;
else
return (((*s1>=‘0’)&&(*s1<=‘9’)) && solecifre(s1+1));
}
-- MatteoLaBella - 22 Mar 2006
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2018-11-28 - AlessandroBasilici






 
Questo sito usa cookies, usandolo ne accettate la presenza. (CookiePolicy)
Torna al Dipartimento di Informatica
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback