38 lines
998 B
C
38 lines
998 B
C
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
#ifndef PANGRAM_H
|
|
#define PANGRAM_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
bool is_pangram(const char *sentence);
|
|
|
|
#endif
|
|
// Please implement the header file from the assignment to fulfill the unit tests..
|
|
// You can add any function
|
|
//#include "pangram.h"
|
|
|
|
|
|
bool is_pangram(const char *sentence) {
|
|
char alphabet[] = "abcdefghijklmnopqrstuvwxyz";
|
|
int is_char_contained[26] = {0};
|
|
int sentence_len = strlen(sentence);
|
|
for (int i = 0; i < sentence_len; i++) {
|
|
int iterator = 0;
|
|
for (int l = 0; l< 26; l++) {
|
|
if (sentence[i] == alphabet[iterator]) {
|
|
is_char_contained[iterator] = 1;
|
|
break;
|
|
}
|
|
iterator++;
|
|
}
|
|
}
|
|
|
|
for (int i = 0; i<26;i++) {
|
|
if (is_char_contained[i] == 0) return 0;
|
|
}
|
|
return 1;
|
|
|
|
}
|