Letter case conversion/c language

In the C language, all 26 uppercase and lowercase letters use ASCII to convert characters into integers and store them in the computer.
So as long as you are familiar with the values ​​represented by the characters in the ASCII table, you can replace uppercase letters with lowercase letters and lowercase letters with uppercase letters through arithmetic operations. The following is the ASCII table

The following is the program for case conversion running in the vs environment

#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include
int main()
{ char s; printf("Please enter any uppercase and lowercase letters\n"); scanf("%c", &s); if (s>='A'&& s<='Z') { printf("%c\n", s + 32); } else { printf("%c\n", s - 32); } return 0; } The following is the C language picture The following is the picture of the program running














case conversion

insert image description here

Guess you like

Origin blog.csdn.net/ambiguous__/article/details/88938049