串-数据结构实验报告[修改版].pdfVIP

  • 0
  • 0
  • 约1.04万字
  • 约 13页
  • 2026-03-06 发布于河南
  • 举报

-

第一篇:串数据结构实验报告

【源程序】:

#include#include#includevoidchoose(char*s,inti,intm,char*t);

//i位置截取m个字符函数voidmain()//主函数{char*s,*t;inti,sl,m;

s=(char*)malloc(100*sizeof(char));

t=(char*)malloc(100*sizeof(char));

printf(\n输入主字符串s=?);gets(s);printf(\ns=%s\n,s);

printf(\n输入位置i=?);scanf(%d,i);printf(\ni=%d\n,i);

printf(\n输入字符个数m=?);scanf(%d,m);printf(\nm=%d\n,m);

sl=strlen(s);

if(isl)printf(i位置出错\n);

elseif(i+msl+1)printf(m位置出错\n);

else

{

choose(s,i,m,t);

printf(\n子串为t

文档评论(0)

1亿VIP精品文档

相关文档