请帮我看下哪个地方越界了,程序报错 “遇到问题需要关闭”
#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void main()
{
char in[10];
char data[10];
char *temp = NULL;
while (true) {
cout << "input:" << endl;
if (temp == NULL || strlen(temp) < 1) {
gets(in);
temp = in;
} else {
//temp += 10;
}
if (strlen(in) == 1 && in[0] == '$') {
break;
}
int start, end;
printf("start:");
cin >> start;
printf("stop:");
cin >> end;
strncpy(data, temp, start);
data[start] = '\0';
cout << data << endl;
temp += start;
strncpy(data, temp, end - start);
data[end - start] = '\0';
cout << data << endl;
temp += end - start;
strcpy(data, temp);
cout << data << endl;
}
}