pvjc20/du1/program.c

33 lines
592 B
C
Raw Normal View History

2020-03-05 23:36:05 +00:00
#include<stdio.h>
#include<stdlib.h>
void printCharacter(int c);
int main() {
int lineCount = 0;
int c;
char outChar;
while((c = getchar()) != EOF) {
if (c >= 'a' && c <= 'z') {
outChar = c - 'a' + 'A';
} else if (c >= 'A' && c <= 'Z') {
outChar = c - 'A' + 'a';
} else {
if (c == '\n') {
lineCount++;
}
outChar = c;
}
printCharacter(outChar);
}
printf("\nPočet riadkov: %d\n", lineCount);
}
void printCharacter(int c) {
printf("%c", c);
}