Title: Input a sentence by the keyboard, the total number of characters from 1 to 80 is possible, with a carriage return to the end, the uppercase letter into lowercase letters, other types of characters unchanged, and finally output the transformed sentence.
Analysis: Input sentence can use the Get function, gets () function is used to read the string from the standard input device (keyboard) until the end of the line break, but the newline character will be discarded, and then add ' the ' "characters at the end of the loop to read each character until the read" "\" Stop, Uppercase letters converted to lowercase letter directly to the ASCII value +32
The code is as follows:
#include <stdio.h>intMain () {Chars[ the], i=0; Gets (s); while(s[i]!=' /') { if(s[i]<='Z'&&s[i]>='A') S[i]+= +; I++; } printf ("%s", s);}
View Code
C language uppercase letters to lowercase