Merge branch 'master' of git.kemt.fei.tuke.sk:ps351zd/pvjc22

This commit is contained in:
Peter Sabol 2022-03-09 08:37:47 +01:00
commit 53b9c2f6d0

View File

@ -1,25 +1,25 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
int main(){ int main(){
int inp_char; int inp_char;
char out_char; char out_char;
int count_lines = 0; int count_lines = 0;
while(1){ while(1){
inp_char = getchar(); inp_char = getchar();
if(inp_char >= 'A' && inp_char <= 'Z') out_char = inp_char + 32; if(inp_char >= 'A' && inp_char <= 'Z') out_char = inp_char + 32;
else if(inp_char >= 'a' && inp_char <= 'z') out_char = inp_char - 32; else if(inp_char >= 'a' && inp_char <= 'z') out_char = inp_char - 32;
else if(inp_char == EOF) break; else if(inp_char == EOF) break;
else if(inp_char == '\n') { else if(inp_char == '\n') {
count_lines++; count_lines++;
out_char = '\n'; out_char = '\n';
} }
else out_char = inp_char; else out_char = inp_char;
putchar(out_char); putchar(out_char);
} }
int counter=0; int counter=0;
counter=count_lines; counter=count_lines;
printf("\nPocet riadkov: %d\n",counter); printf("\nPočet riadkov: %d\n",counter);
return 0; return 0;
} }