当前位置:网站首页>输入一行字符(最多80个),从第location个位置开始,截取number个字符并将其输出。
输入一行字符(最多80个),从第location个位置开始,截取number个字符并将其输出。
2022-06-09 12:41:00 【laocooon】
1. 输入一行字符(最多80个),从第location个位置开始,截取number个字符并将其输出。
【源程序】
#include<stdio.h>
#include<string.h>
char substring[80];
char *cut(char *str,int location,int number)
{
int i,j;
j=strlen(str);
location--;
if(j<location)
return str;
for(i=0;i<number;i++)
if(str[location]!='\0')
substring[i]=str[location++];
else
break;
substring[i]='\0';
return substring;
}
void main()
{
char *sp,str[80];
int loc=0,num=0;
scanf("%s%d%d",str,&loc,&num);
sp=cut(str,loc,num);
printf("%s\n",sp);
printf("\n");
}
边栏推荐
- 网络原理-TCP
- Digital transformation: how to gain organizational recognition?
- Yunna database monitoring tool, database monitoring operation and maintenance tool
- MySQL数据库(25):外键 foreing key
- 网络七层结构是干啥的?看这篇文章就够了
- go语言搬砖之gojmespath实现查询json数据
- 2022.5.27-----leetcode.面试17.11
- 面试题 08.08. 有重复字符串的排列组合
- What's the use of finding amino acids in extraterrestrial life?
- Dr. Stanford put forward the idea of ultra fast and saving memory attention. The gpt-2 training speed was increased by 3.5 times, and the Bert speed reached a record
猜你喜欢

5G發牌三周年 雲網融合加速 如何解决企業網絡之憂?

win11启用多用户远程桌面同时登陆
![[leetcode weekly race record] record of the 79th biweekly race + the 295th weekly race](/img/ce/bf00add3a54f9efd0776dda522f31f.png)
[leetcode weekly race record] record of the 79th biweekly race + the 295th weekly race

15 Uncaught TypeError: Cannot set properties of null (setting ‘onclick‘)

leetcode:497. 非重叠矩形中的随机点【随缘随机 + 前缀和二分 + 过了就行】

Dr. Stanford put forward the idea of ultra fast and saving memory attention. The gpt-2 training speed was increased by 3.5 times, and the Bert speed reached a record

Hit the snake seven inches

使用nodejs导出md/Markdown文档当中的图片到本地并替换原始图片链接为本地图片链接

他26岁,发表论文18篇,刚把上世纪的素数猜想给证明了

网络空间测绘国内外发展及现状
随机推荐
测试概念篇
打蛇打七寸
在这些根技术里,读懂华为的“三观”
Comment résoudre le problème du réseau d'entreprise en accélérant la fusion du réseau Cloud pour le troisième anniversaire de la licence 5G?
QUIC必看
TCP/IP协议机制详解
面试题 08.08. 有重复字符串的排列组合
超越ReLU却鲜为人知,3年后被挖掘:BERT、GPT-2等都在用的激活函数
云呐|公司实物资产如何管理
Prototype chain? New misconceptions
云呐|数据库监控一般监控什么
Yunna | how to manage fixed assets better? How to manage the company's fixed assets?
Yunna | which department manages the fixed assets and who manages them
虚拟消费引领新时尚 互融云NFT系统平台定制开发 助力企业打开“Z”时代
Weici technology completed a round of financing of more than 100 million yuan, and the core team graduated from Beijing Airlines
Network attacks focus on people's livelihood. How can we effectively defend against DDoS and apt attacks?
What is the difference between delete, drop and truncate in MySQL
Zhoubolei annual progress overview of model interpretability 20200805
简单说说路由器和交换机的区别
Wsl2 environment setup