当前位置:网站首页>The following program deletes n consecutive words starting from the ith character from the string str
The following program deletes n consecutive words starting from the ith character from the string str
2022-04-23 08:09:00 【laocooon】
#include <stdio.h>
#include <string.h>//string Turned out to be stdlib
void main()
{ char str[81];
int i,n;
printf(" Please enter the string str Value :\n");
scanf("%s",str);
printf(" The string you entered str yes :%s\n",str);
printf(" Please enter the deletion location i And the number of characters to be deleted n Value :\n");
scanf("%d%d",&i,&n);
while (i+n-1>strlen(str))
{ printf(" Delete location i And the number of characters to be deleted n The value of is wrong ! Please re-enter i and n Value \n");
scanf("%d%d",&i,&n);
}
while(str[i+n-1])//str[i+n]
{ str[i-1]=str[i+n-1];
i++;
}
str[i-1]='\0';//str[i]='\0';
printf(" The deleted string str yes :%s\n",str);
}
版权声明
本文为[laocooon]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230638292684.html
边栏推荐
猜你喜欢
在MATLAB中快速画圆(给出圆心坐标和半径就能直接画的那种)
数据安全问题已成隐患,看vivo如何让“用户数据”重新披甲
Ctf-misc learning from start to give up
数据库之MySQL——基本常用查询命令
Buuctf misc brush questions
Ribbon start process
Draw a circle quickly in MATLAB (the one that can be drawn directly given the coordinates and radius of the center of the circle)
简述CPU
简述存储器的分级策略
在线YAML转XML工具
随机推荐
Asynchronous learning
分布式服务治理Nacos
BUUCTF MISC刷題
使用 Ingress 实现金丝雀发布
1216_MISRA_C规范学习笔记_控制流的规则要求
Ctf-misc learning from start to give up
sentinel集成nacos动态更新数据原理
strcat()、strcpy()、strcmp()、strlen()
Attack and defense world misc questions 1-50
DVWA靶场练习
国基北盛-openstack-容器云-环境搭建
[programming practice / embedded competition] learning record of embedded competition (II): picture streaming based on TCP
如何在SQL Server中导入excel数据,2019版
云计算技能大赛 -- openstack私有云环境 第一部分
yum源仓库本地搭建的两种方法
利用sqlmap注入获取网址管理员账号密码
LeetCode 1611. 使整数变为 0 的最少操作次数
AAAI 2022招募讲者啦!!
Buuctf misc brush questions
数据库之Mysql——概述安装篇