1
我的問題在於,我的基本情況永遠不會執行,因爲循環,這是運行應用程序的主要組件沒有執行。我正在考慮創建一個嵌入式for循環,但我想不出讓for循環從最大向量位置向最小向量位置擺動的方法。此外,要注意觀察前V3是一個很小的事情同時包含對象A和B,因爲對象C是A和B振盪爲循環遞歸行動
MCVE版本的超:http://coliru.stacked-crooked.com/a/c6fdc017118e98f2
void Obj::objhelper()
{
recurisivehelper();
if ((v1[0].getx() == 0 && v2[0].getx() > 0) ||
(v1[0].getx() > 0 && v2[0].getx() == 0))
{
if (v1[0].getx() == 0 && v2[0].getx() > 0)
{
print(3);
return;
}else
{
print(4);
return;
}
}
else if(v1[0].getx() > 0 && v2[0].getx() > 0)
{
objhelper();
}
return;
}
//This method is not touched
//This is a recursive helper method of the helper method of the main method
void Obj::recursivehelper()
{
for (int i = 0; i < 2; i++) {
if (v3[i].gety() == "str1" ||
v3[i].gety() == "str2" ||
v3[i].gety() == "str3")
{
int temp = 0;
Obj1 obj(v1,:v2);
obj.display();
v3[i].doa(v3[i + 1]);
obj.display();
v2[0]--;
}else if (v3[i].gety() == "str4" ||
v3[i].gety() == "str5" ||
v3[i].gety() == "str6" )
{
Obj1 obj(v1,sv2);
obj.display();
v3[i].doa(v3[i + 1]);
obj.display();
v1[0]--;
}
}
return;
}
如果您發佈了[MCVE](https://stackoverflow.com/help/mcve)例如在http://ideone.com/或http://coliru.stacked-crooked.com/與一個可運行的主,這個問題將是非常有吸引力的解決。 – javaLover
這是C++中的一個MCVE版本http://coliru.stacked-crooked.com/a/a268bd6b5618a768 – KRYMauL
不錯,它好得多。然而,它不是可編譯的,所以它仍然不是MCVE,只是這個問題是關於編譯器錯誤的問題。 ...我想有人正在盯着這個問題,一旦你提供了MCVE,你會馬上得到答案。 – javaLover