c语言程序设计题目(急求)

[复制链接]
查看11 | 回复2 | 2009-7-16 21:35:06 | 显示全部楼层 |阅读模式
//编写求子串函数substr(s,n1,n2),在串s中从n1位置开始取n2个字符的子串 #include "stdio.h"#include "iostream.h"char * substr(char *s,int n1,int n2){ char *b=new char[100]; int z=0; for(int i=n1;i<=n2;i++) {b[z]=s;z++;if(i==n2){ b[z]='\0';} } return b;}void main(){ printf("%s",substr("123456789"...
回复

使用道具 举报

千问 | 2009-7-16 21:35:06 | 显示全部楼层
这不是数据结构串的基本操作吗?...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行