当前位置:网站首页>Pointer -- eliminate all numbers in the string
Pointer -- eliminate all numbers in the string
2022-07-06 14:36:00 【|Light|】
requirement
Make up a function , Eliminate all numbers in the string .( Use a pointer to achieve )
Code
#include<stdio.h>
/* * This function is used to delete all numbers in the string *a Is a pointer to a string array */
char *delete_digit(char *a)
{
int l = strlen(a);
char b[l];
int i,j=0,k;
for(i=0;i<l;i++)
{
if(a[i]>='0'&&a[i]<='9')
continue;
else
{
b[j] = a[i];
j++;
}
}
for(i=0;i<l;i++)
{
a[i] = '\0';
}
for(i=0;i<l-2;i++)
{
if(b[i]=='.')
{
if(b[i+2]>='a'&&b[i+2]<='z')
continue;
else if(b[i+2]>='A'&&b[i+2]<='Z')
continue;
else
b[i+1]='\0';
}
}
strcpy(a,b);
return a;
}
main function
int main()
{
char a[200];
gets(a);
delete_digit(a);
puts(a);
return 0;
}
test
Test input
123Try234 you53r b5234est wh2435en y25ou2 are 5234young. 45324Never524 regret523.
Output
Try your best when you are young. Never regret.
边栏推荐
- What language should I learn from zero foundation. Suggestions
- 指针 --按字符串相反次序输出其中的所有字符
- XSS (cross site scripting attack) for security interview
- Matplotlib绘图快速入门
- 【指针】统计一字符串在另一个字符串中出现的次数
- 《统计学》第八版贾俊平第六章统计量及抽样分布知识点总结及课后习题答案
- Feature extraction and detection 14 plane object recognition
- 图书管理系统
- 数据库多表链接的查询方式
- Interview Essentials: what is the mysterious framework asking?
猜你喜欢
Record an API interface SQL injection practice
Mysql的事务是什么?什么是脏读,什么是幻读?不可重复读?
Only 40% of the articles are original? Here comes the modification method
Proceedingjoinpoint API use
Record once, modify password logic vulnerability actual combat
“人生若只如初见”——RISC-V
Résumé des points de connaissance et des réponses aux exercices après la classe du chapitre 7 de Jia junping dans la huitième édition des statistiques
数字电路基础(四) 数据分配器、数据选择器和数值比较器
内网渗透之内网信息收集(二)
《统计学》第八版贾俊平第七章知识点总结及课后习题答案
随机推荐
Hackmyvm target series (2) -warrior
Data mining - a discussion on sample imbalance in classification problems
数字电路基础(四) 数据分配器、数据选择器和数值比较器
《统计学》第八版贾俊平第七章知识点总结及课后习题答案
Record an API interface SQL injection practice
内网渗透之内网信息收集(四)
Harmonyos application development -- address book management system telmanagesys based on listcontainer [phonebook][api v6]
《统计学》第八版贾俊平第十章方差分析知识点总结及课后习题答案
Statistics 8th Edition Jia Junping Chapter 14 summary of index knowledge points and answers to exercises after class
List and data frame of R language experiment III
Attack and defense world misc practice area (simplerar, base64stego, no matter how high your Kung Fu is, you are afraid of kitchen knives)
《统计学》第八版贾俊平第十四章指数知识点总结及课后习题答案
flask实现强制登陆
Applet Web Capture -fiddler
Matplotlib绘图快速入门
Web vulnerability - File Inclusion Vulnerability of file operation
Statistics 8th Edition Jia Junping Chapter 10 summary of knowledge points of analysis of variance and answers to exercises after class
Statistics 8th Edition Jia Junping Chapter XIII Summary of knowledge points of time series analysis and prediction and answers to exercises after class
Overview of LNMP architecture and construction of related services
图书管理系统