hw-00: Added my solution to the homework
This commit is contained in:
parent
182b225ea4
commit
830927fb06
42
homework-00-warmup/main.c
Normal file
42
homework-00-warmup/main.c
Normal file
@ -0,0 +1,42 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
const char * PROMPT = "ml' nob:";
|
||||
|
||||
const char * INPUT_OKAY = "Qapla'";
|
||||
const char * OUT_OF_RANGE = "Qih mi'";
|
||||
const char * NOT_A_NUMBER = "Neh mi'";
|
||||
|
||||
const char * QUOTES[9] = {
|
||||
"noH QapmeH wo' Qaw'lu'chugh yay chavbe'lu' 'ej wo' choqmeH may' DoHlu'chugh lujbe'lu'.",
|
||||
"bortaS bIr jablu'DI' reH QaQqu' nay'.",
|
||||
"Qu' buSHa'chugh SuvwI', batlhHa' vangchugh, qoj matlhHa'chugh, pagh ghaH SuvwI''e'.",
|
||||
"bISeH'eghlaH'be'chugh latlh Dara'laH'be'.",
|
||||
"qaStaHvIS wa' ram loS SaD Hugh SIjlaH qetbogh loD.",
|
||||
"Suvlu'taHvIS yapbe' HoS neH.",
|
||||
"Ha'DIbaH DaSop 'e' DaHechbe'chugh yIHoHQo'.",
|
||||
"Heghlu'meH QaQ jajvam.",
|
||||
"leghlaHchu'be'chugh mIn lo'laHbe' taj jej."
|
||||
};
|
||||
|
||||
int main() {
|
||||
int input = 0;
|
||||
|
||||
printf("%s\n", PROMPT);
|
||||
int result = scanf("%d", &input);
|
||||
|
||||
if(result != 1) {
|
||||
printf("%s\n", NOT_A_NUMBER);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if(input < 0 || input > 8) {
|
||||
printf("%s %d\n", OUT_OF_RANGE, input);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("%s\n", INPUT_OKAY);
|
||||
printf("%s\n", QUOTES[input]);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user