program chashes


I need help figuring this out, this program works fine on my linux machine but not my mac. when I run it on the mac, sometimes it crashes, but not on linux. can you tell why it crashes on the mac because i figure it out...



cin >> hold_letters;
cin >> first_letters_1;
cin >> second_letters_2;
cin >> third_letters_3;

strcpy (fenter2letters,hold_letters);
strcat (fenter2letters,first_letters_1);
strcat (fenter2letters,second_letters_2);
strcat (fenter2letters,third_letters_3);


for (int x=0; x<firs.size(); x++){

nextwrr:
strcpy (first,firs[x].c_str());

strcpy (second,fenter2letters);
int first_l = strlen(first);
if (first_l==1){
x=x+1;
goto nextwrr;}
c=0;
int second_length = strlen(second);
for (int cycle=0; cycle<first_l; cycle++){
nextlrr:
for (int match=0; match<second_length; match++){
if (first[cycle] == second[match]) {
memcmp (&second[match], &second[match+1], second_length-match);
memmove (&second[match], &second[match+1], second_length-match);
second_length--;
c=c+1;
cycle=cycle+1;
goto nextlrr;
}}}
if (c==first_l){
xf=0;
xt=0;
first_lters = strlen(first_letters_1);
second_lters = strlen(second_letters_2);
third_lters = strlen(third_letters_3);
postion=0;

hcnt=0;

numbers.clear();
hcnt=first_l-second_lters-spaces_1;
for (int x=0; x<hcnt; x++){

if (first_letters_1[xf]==first[x])
{ xf=xf+1;

numbers.push_back(x);

postion=x;
hcnt=x+2;

}

}
xs=0;
for (int x=postion+spaces_1+1; x<postion+spaces_1+second_lters+1; x++){
if (second_letters_2[xs]==first[x])
{ xs=xs+1;
numbers.push_back(x);

}
if (xs==second_lters && xf==first_lters)
strcpy (hword,first);

}

}
xt=0;

for (int xe=postion+spaces_1+second_lters+1+spaces_2; xe<postion+spaces_1+second_lters+1+spaces_2+third_lters; xe++){
//cout <<" xe "<<xe<<endl;
if (third_letters_3[xt]==first[xe])
{ xt=xt+1;
numbers.push_back(xe);
}

if (strcmp(first,hword )==0)
if (xs==second_lters && xf==first_lters && xt==third_lters)
{
cout <<" Match for: "<<first_letters_1<<"-"<<second_letters_2<<"-"<<third_letters_3<<" --";
for (int loop=0; loop<first_l; loop++)
{
for (int x=0; x<numbers.size(); x++)
if (loop==numbers[x])
{
cout <<first[loop];

loop++;
}
cout <<"\x1b[31;1m";
cout << first[loop];
cout <<"\033[0m";
}
numbers.clear();
cout <<" "<<first_l<<endl;
}
}


}
Last edited on
Is it a puzzle? :-)
To check a code which apparently works, we need al least to compile it. Your code is incomplete and not compilable.
Topic archived. No new replies allowed.