pvjc26/a1/program.c

45 lines
885 B
C

#include <stdio.h>
#include <ctype.h>
int main()
{
int pocetRiadkov = 0;
while (1)
{
int trebaPridatNewLine = 1;
int vstup = getchar();
if (vstup == EOF) {break;}
if (vstup == '\n')
{
pocetRiadkov += 1;
putchar(vstup);
trebaPridatNewLine = 0;
}
else if (vstup == '\r')
{
continue;
}
else if (islower(vstup) != 0)
{
putchar(toupper(vstup));
}
else if (isupper(vstup) != 0)
{
putchar(tolower(vstup));
}
else if (vstup >= 32 && vstup <= 255)
{
putchar(vstup);
}
}
if (trebaPridatNewLine == 1)
{
char NewLine = '\n';
printf("%c", NewLine);
}
printf("Lines_count: %d\n", pocetRiadkov);
return 0;
}