当前位置:网站首页>Header file ctype H (detailed)
Header file ctype H (detailed)
2022-07-16 08:00:00 【Steal the mask and run away】
1、ctype.h The function in

2、 Code understanding
#include<iostream>
#include<algorithm>
#include<ctype.h>
#include<cstring>
using namespace std;
int main()
{
char str[1007];
cin>>str;
int len = strlen(str);
for(int i=0;i<len; i++)
{
if(isalnum(str[i])) // Judge whether it is a number or a letter
{
if(isdigit(str[i])) // Judge whether it's a number
{
cout<<" It's a number :"<<str[i]<<endl;
}
if(isalpha(str[i])) // Decide if it's a letter
{
if(islower(str[i])) // Determine if it's lowercase
{
cout<<" Change lowercase to uppercase :"<<char(toupper(str[i]))<<endl;// Change lowercase letters to uppercase letters
}
if(isupper(str[i])) // Decide if it's a capital letter
{
cout<<" Change uppercase to lowercase :"<<char(tolower(str[i]))<<endl;// Change uppercase letters to lowercase letters
}
}
}
if(!isalnum(str[i]))
{
cout<<" It's not a letter or a number :"<<str[i]<<endl;
}
}
return 0;
}
Running results :

Other functions can be used by yourself ~
边栏推荐
- Principle and configuration of static routing
- Set、Map、WeakSet 和 WeakMap 的区别
- HCIA复习
- A few lines of code can realize complex excel import and export. This tool class is really powerful!
- Day 9 of leetcode question brushing
- Reptile Youdao translation
- 源码编译装redis
- nodejs使用multe实现文件上传,并将文件存储在服务器
- CCF 202012-2 optimal threshold for period end forecast
- Introduction to C language compiler
猜你喜欢

一次简单的 JVM 调优,拿去写到简历里

File management - Alibaba cloud OSS learning (I)

头文件ctype.h(详细)

I2C protocol

CentOS 7x installing MySQL database

Solve the problem of missing precision of bigint type data in MySQL query data in nodejs

uni-app解决无法在线浏览pdf文件问题

CCF 202012-2 optimal threshold for period end forecast

使用Code First

XPath ultra detailed summary
随机推荐
CCF 201909-1 scale detection point query
Installing stand-alone redis under Linux
64 bit integer division multiplication
(一)输入输出
Layer 3 switching and VRRP
1. STM32F4 USB协议研究 - USB协议
Generics of C #
ELECTRA
jsonp原理
rasa action 服务并发
DL day 2
Day 6 of leetcode question brushing
小白能看懂等Tacotron 中文语音合成实践
V891-z3735f redo system, drive repair summary
C excel net core reading xlsm
GoFrame Step by Step Demo - P1
Automatically back up mysql. And keep the case for 7 days
C verification code
Code de vérification
Azkaban概述