school/lepsiznak.c
2024-01-22 14:41:15 +01:00

31 lines
522 B
C

//
// Created by bruno on 12/11/23.
//
#include "lepsiznak.h"
#include "stdio.h"
void invertcase(int *c) {
if (*c >= 'a' && *c <= 'z') {
*c -= 0x20;
} else if (*c >= 'A' && *c <= 'Z') {
*c += 0x20;
}
}
int lepsiznak() {
int c;
int pocet = 0;
const int koniec = 'k';
while ((c = getchar()) != koniec) {
invertcase(&c);
putchar(c);
pocet++;
}
printf("\nVydržal si %d znakov pred tým, ako si napísal %c.\n", pocet, koniec);
return 0;
}