黑色毛衣
小水手

UID 30139
精华
0
积分 4
帖子 4
阅读权限 10
注册 2007-5-25
状态 离线
|
没看你的代码,这是我的代码...没有goto
#include <iostream.h>
#define LINE 5
#define ROW 5
int a[LINE][ROW] = {10,2,3,4,5,16,7,8,9,4,5,1,2,3,4,14,5,6,1,2,13,1,2,3,9};
bool CheckTheLIne(int temp,int line)
{
bool bRet = true;
for(int i = 0;i<ROW;i++)
{
if(temp < a[line][i])
{
bRet = false;
}
}
return bRet;
}
int CheckTheRow(int row)
{
int iRet=a[0][row];
for(int i = 1;i<LINE;i++)
{
if(iRet>a[i][row])
{
iRet = a[i][row];
}
}
return iRet;
}
bool Search()
{
bool bRet = false;
for(int i =0;i<ROW;i++)
{
int temp = CheckTheRow(i);
for(int j=0;j<LINE;j++)
{
if(temp == a[j][i])
{
if(CheckTheLIne( temp,j) )
{
cout<<"a["<<j<<"]["<<i<<"]:"<<a[j][i]<<"\n";
bRet = true;
}
}
}
}
return bRet;
}
void main()
{
if( !Search())
{
cout<<"NULL"<<endl;
}
}
|
|