aktivita 2 mozno done
This commit is contained in:
parent
c342f6dffe
commit
4a2ad2cc66
29
a2/program.c
Normal file
29
a2/program.c
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
// 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";
|
||||||
|
char is_char_contained[] = "00000000000000000000000000";
|
||||||
|
for (int i = 0; i < sizeof(sentence); i++) {
|
||||||
|
int iterator = 0;
|
||||||
|
for (int l = 0; l< 26; l++) {
|
||||||
|
if (sentence[i] == sentence[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;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user