複製程式
#include<iostream>
using namespace std;
int main(int argc, char* argv[])
{
int i,j ;
int math[2][3]={{1,1,2},{2,3,5}};
int temp[2][3];
do{
if(math[0][0]!=1)
{
temp[0][0]=math[0][0]-math[0][0];
temp[0][1]=math[0][1]-math[0][1];
temp[0][2]=math[0][2]-math[0][2];
}
if(math[0][0]==1)
{
do{
temp[0][0]=math[0][0];
temp[0][1]=math[0][1];
temp[0][2]=math[0][2];
temp[1][0]=math[1][0]-math[0][0];
temp[1][1]=math[1][1]-math[0][1];
temp[1][2]=math[1][2]-math[0][2];
}while(temp[1][0]!=0);
}
}while(temp[0][0]!=1 && temp[1][0]==0);
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
{
cout<<temp[i][j]+" ";
}
}
return 0;
}
你的Array宣告錯誤
所以compiler會有很多錯誤訊息
你的運算方式看了一下
應該程式無法結束 因為會在loop裡面一直跑