Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Tisknuti retezcu a zmnena pismenek z v na m
#include <stdio.h> #define N 20 #define _CRT_SECURE_NO_WARNING int main(void) { char str[N + 1] = { '\0'}; // +1 pro zapsání ukončujícího znaku \0 pro "" se zapisují automaticky printf("Zadej retezec: \n"); //scanf("%s", str); znaky mezera a enter ukončují printf for(size_t i = 0; i < N; ++i) { int ch = getchar(); if(ch == EOF || ch == '\n')//EOF - end of file { str[i] = '\0'; break; } str[i] = (char) ch; } printf("Retezes: %s \n", str); //%s tiskne string size_t pocet_vp = 0; for(size_t i = 0; str[i] != '\0' && (i < N); ++i) { //if(str[i] >= 'A' && str[i] <= 'Z') ++pocet_vp; if(isupper(str[i]) != 0) { //str[i] += 'a' - 'A'; //pricte rozdil velkych a a malip písmen str[i] = tolower(str[i]); ++pocet_vp; } } printf("Pocet velkych pismen je: %zu \n", pocet_vp); printf("Opraveny retezec: %s\n", str); return 0; }
run
|
edit
|
history
|
help
0
test
Cross Platform Support for sprintf's Format '-Flag
BPC cv 5_Test
Hello
inicializace struktury
TBod
pointery
amal
TVector
problem_solution_1