标签:include
#include<stdio.h> #include<stdlib.h> int find(int arry[100][100], int x, int y, int key) { int i = 0; int j = 0; for (i = 0; i<x; i++) { for (j = 0; j<y; j++) { if (key == arry[i][j]) return 1; } } return -1; } int main() { int arr[100][100]; int m, n; int ret;int k; printf("输入要查询的数:"); scanf_s("%d", &k); printf("输入行和列:"); scanf_s("%d%d", &m, &n); printf("输入%d行%d列的数:\n",m,n); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { scanf_s("%d", &arr[i][j]); } } ret = find(arr, m, n, k); if (ret == 1) printf("存在!"); else printf("不存在!"); system("pause"); return 0; }
标签:include
原文地址:http://10738432.blog.51cto.com/10728432/1709745