题目链接:6-10 使用函数实现字符串部分复制 (20 分)
#include <stdio.h>
#include<string.h>
#define MAXN 20
void strmcpy( char *t, int m, char *s );
void ReadString( char s[] ); /* 由裁判实现,略去不表 */
int main()
{
char t[MAXN], s[MAXN];
int m;
scanf("%d\n", &m);
ReadString(t);
strmcpy( t, m, s );
printf("%s\n", s);
return 0;
}
/* 你的代码将被嵌在这里 */
void ReadString( char s[] )
{
gets(s);
}
void strmcpy( char *t, int m, char *s )
{
int count=0;
int len=strlen(t);
for(int i=m-1;i<len;i++)
{
s[count++]=t[i];
}
s[count]='\0';
}