题解 | #截取字符串#
截取字符串
http://www.nowcoder.com/practice/a30bbc1a0aca4c27b86dd88868de4a4a
#include "stdio.h"
int main()
{
char buf[101];
int num=0;
while(scanf("%s",buf)!=EOF)
{
scanf("%d",&num);
buf[num]='\0';
printf("%s\n",buf);
}
return 0;
}
好像是最简单的方法