This commit is contained in:
Artem Horbunov 2020-03-06 11:16:53 +01:00
parent 3aa99bdd09
commit 0374179528

View File

@ -1,38 +1,41 @@
#include <stdio.h>
#include <string.h>
#include<stdio.h>
char change(char inp){
if(inp >= 'A' && inp <= 'Z'){
inp += 'a' - 'A';
return inp;
}
else if(inp >= 'a' && inp <= 'z'){
inp -= 'a' - 'A';
return inp;
}
}
int main(){
int c = 0;
char text[256];
while(1){
char ch;
int num = 'a' - 'A';
scanf("%c", &ch);
if(ch == EOF || ch == -1){
break;
}
c++;
if(ch <= 'A' && ch >= 'Z'){
ch += num;
c--;
}
else if(ch >= 'a' && ch <= 'z'){
ch -= num;
c--;
}
text[c] = ch;
}
printf("%d\n", strlen(text));
for(int i = 0; i < c; i++){
if(text[i] != '\n'){
printf("%c\n", text[i]);
}
else{
printf("\n");
}
}
printf("%d\n", c);
char text[255];
int num = 0;
for(int i = 0; text[i] != EOF; i++){
scanf("%c", &text[i]);
}
int len = sizeof(text);
for(int i = 0; i < len; i++){
if(text[i] == '\n') num += 1;
}
for(int i = 0; text[i] != '\n'; i++){
printf("%c\n", change(text[i]));
}
for(int i = -1; i < num; i++){
printf("\n");
}
printf("Počet riadkov: %d\n", num);
return 0;
}