typedef int bool;
#define TRUE 1
#define FALSE 0
typedef char TipoLettera;
typedef bool TipoInsLettere['Z' - 'A' + 1];
void InitInsLettere(TipoInsLettere ins)
{
TipoLettera ch;
for (ch = 'A'; ch <= 'Z'; ch++)
ins[ch - 'A'] = FALSE;
}
bool TestInsiemeVuoto(TipoInsLettere ins)
{
bool ris = TRUE;
TipoLettera ch;
for (ch = 'A'; ch <= 'Z'; ch++) {
if (ins[ch - 'A'])
ris = FALSE;
}
return ris;
}
void InserisciLettera(TipoInsLettere ins, TipoLettera lettera)
{
ins[lettera - 'A'] = TRUE;
}
void EliminaLettera(TipoInsLettere ins, TipoLettera lettera)
{
ins[lettera - 'A'] = FALSE;
}
bool VerificaAppartenenza(TipoInsLettere ins, TipoLettera lettera)
{
return (ins[lettera - 'A']);
}
void Unione(TipoInsLettere ins1, TipoInsLettere ins2,
TipoInsLettere ins_unione)
{
TipoLettera ch;
for (ch = 'A'; ch <= 'Z'; ch++)
ins_unione[ch - 'A'] = (ins1[ch - 'A'] || ins2[ch - 'A']);
}
void Intersezione(TipoInsLettere ins1, TipoInsLettere ins2,
TipoInsLettere ins_int)
{
TipoLettera ch;
for (ch = 'A'; ch <= 'Z'; ch++)
ins_int[ch - 'A'] = (ins1[ch - 'A'] && ins2[ch - 'A']);
}
void Complemento(TipoInsLettere ins, TipoInsLettere ins_compl)
{
TipoLettera ch;
for (ch = 'A'; ch <= 'Z'; ch++)
ins_compl[ch - 'A'] = !ins[ch - 'A'];
}