31 lines
522 B
C
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;
|
|
|
|
}
|