Pangram checker: Difference between revisions
Content added Content deleted
(→{{header|TXR}}: Stray text removed.) |
(→{{header|C}}: drop unneeded headers; slight cleanup) |
||
Line 232: | Line 232: | ||
=={{header|C}}== |
=={{header|C}}== |
||
<lang C>#include <stdio.h> |
<lang C>#include <stdio.h> |
||
#include <stdlib.h> |
|||
#include <string.h> |
|||
int isPangram(const char *string) |
int isPangram(const char *string) |
||
{ |
{ |
||
char ch, wasused[26]; |
char ch, wasused[26] = {0}; |
||
int total = 0; |
int total = 0; |
||
⚫ | |||
memset(wasused, 0, sizeof(wasused)); |
|||
⚫ | |||
int index; |
int index; |
||
Line 250: | Line 247: | ||
else |
else |
||
continue; |
continue; |
||
⚫ | |||
total += !wasused[index]; |
|||
⚫ | |||
total++; |
|||
} |
|||
} |
} |
||
return (total==26); |
return (total==26); |
||
Line 260: | Line 256: | ||
int main() |
int main() |
||
{ |
{ |
||
int i; |
|||
⚫ | |||
const char * |
const char *tests[] = { |
||
⚫ | |||
⚫ | |||
"The qu1ck brown fox jumps over the lazy d0g." |
|||
printf("\"%s\" is %sa pangram\n", not_a_pangram, isPangram(not_a_pangram)?"":"not "); |
|||
}; |
|||
for (i = 0; i < 2; i++) |
|||
⚫ | |||
tests[i], isPangram(tests[i])?"":"not "); |
|||
return 0; |
return 0; |
||
}</lang> |
}</lang> |