我想用C语言编写一个程序,它将使用函数将文本的字母从大写变为小写,但它会使每个句子的首字母保持大写。 适用于LEAF。是什么?绿色!我需要将其转换为Leaf.Is?绿色!大写字母小写函数C
#include <stdio.h>
char upper_to_low(char s[]) {
int c = 0;
while (s[c] != '\0') {
if ((s[c] >= 'A' && s[c] <= 'Z') && c > 0) {
s[c] = s[c] + 32;
}
c++;
}
}
int main() {
char text[100];
printf("Text\n");
gets(text);
upper_to_lower(text);
printf("This is the text\n %s", text);
return 0;
}
那么上面给出的输出是什么? –
如果我写的叶子是绿色的。输出是叶子是绿色的。所以它适用于第一句,因为它跳过了第一个字符。 – Nica