1.����������Դ��
����������Դ��
#include "iostream.h"
typedef struct Point
{
int row;
int col;
}Point;
void statics(int arr[][3], int rows, int cols)
{
int i, j;
int min = arr[0][0]; //最小值
Point pos[9]; //记录最小值的下标
int count = 0; //最小值个数
//搜索最小值
for(i=0; i<rows; i++)
for(j=0; j<cols; j++)
if(arr[i][j] < min)
min = arr[i][j];
//记录最小值的位置、统计最小值的数组数组avifile源码个数
for(i=0; i<rows; i++)
for(j=0; j<cols; j++)
if(arr[i][j] == min)
{
pos[count].row = i + 1;
pos[count].col = j + 1;
count++;
}
//输出结果
cout<<"数组最小值个数为:"<<count<<endl;
for(i=0; i<count; i++)
{
cout<<"第"<<i<<"个最小值坐标为:("<<pos[i].row<<","<<pos[i].col<<")"<<endl;
}
}
void main()
{
int arr[3][3]= { { 5,5,7}, { 4,5,4}, { 3,2,2}};
statics(arr, 3, 3);
}
2024-11-23 07:57
2024-11-23 07:42
2024-11-23 07:41
2024-11-23 07:05
2024-11-23 06:57
2024-11-23 06:27
2024-11-23 06:09
2024-11-23 06:08