Anonymous user
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
{
const char *alpha = ""
"abcdefghjiklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char ch, wasused[26] = {0};
int total = 0;
while ((ch = *
int idx;
if (
continue;
wasused[index] = 1;▼
total += !wasused[idx];
if (total == 26)
return 1;
}
return
}
int main(void)
{
int i;
Line 602 ⟶ 607:
for (i = 0; i < 2; i++)
printf("\"%s\" is %sa pangram\n",
tests[i],
return 0;
}</lang>
|