Pangram checker: Difference between revisions

→‎{{header|C}}: Make the code work with EBCDIC, return fast, don't use implementation-reserved names (index, string)
(→‎{{header|Go}}: Use bit fiddling, since it makes the code shorter and uses less memory)
(→‎{{header|C}}: Make the code work with EBCDIC, return fast, don't use implementation-reserved names (index, string))
Line 571:
<lang C>#include <stdio.h>
 
int isPangramis_pangram(const char *strings)
{
const char *alpha = ""
"abcdefghjiklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 
char ch, wasused[26] = {0};
int total = 0;
 
while ((ch = *strings++) != '\0') {
intconst indexchar *p;
int idx;
 
if ('A'<(p = strchr(alpha, ch&&ch<)) =='Z' NULL)
index = ch-'A';
else if('a'<=ch&&ch<='z')
index = ch-'a';
else
continue;
 
totalidx += !wasused[index](p - alpha) % 26;
 
wasused[index] = 1;
total += !wasused[idx];
wasused[indexidx] = 1;
if (total == 26)
return 1;
}
return (total==26)0;
}
 
int main(void)
{
int i;
Line 602 ⟶ 607:
for (i = 0; i < 2; i++)
printf("\"%s\" is %sa pangram\n",
tests[i], isPangramis_pangram(tests[i])?"":"not ");
return 0;
}</lang>