12-20-2015, 10:13 AM
Kod:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int matris[5][8]={ {1,5,6,7,8,2,3,5},
{6,9,3,6,7,9,5,3},
{2,6,1,0,3,2,0,3},
{9,3,6,8,7,4,8,9},
{5,2,3,4,9,5,2,4} };
int aranan_matris[3][4]={ {7,9,5,3},
{3,2,0,3},
{7,4,8,9} };
int a, b, c, d, bulundu=0;
int bulundugu_satir, bulundugu_sutun;
for(a=0; a<=5-3; a++){
for(b=0; b<=8-4; b++){
if(aranan_matris[0][0]==matris[a][b]){
bulundugu_satir=a;
bulundugu_sutun=b;
for(c=0; c<3; c++){
for(d=0; d<4; d++){
if(aranan_matris[c][d]==matris[a+c][b+d])
bulundu=1;
else{
bulundu=0;
break;
}
}
if(bulundu==0)
break;
}
}
if(bulundu==1){
printf("\n Matris %d. satir %d. sutunda bulundu.\n", bulundugu_satir+1, bulundugu_sutun+1);
return 0;
}
}
}
if(bulundu==0)
printf("\n Matris bulunamadi.\n");
return 0;
}[/b]
#include <stdio.h>
#include <stdlib.h>
int main()
{
int matris[5][8]={ {1,5,6,7,8,2,3,5},
{6,9,3,6,7,9,5,3},
{2,6,1,0,3,2,0,3},
{9,3,6,8,7,4,8,9},
{5,2,3,4,9,5,2,4} };
int aranan_matris[3][4]={ {7,9,5,3},
{3,2,0,3},
{7,4,8,9} };
int a, b, c, d, bulundu=0;
int bulundugu_satir, bulundugu_sutun;
for(a=0; a<=5-3; a++){
for(b=0; b<=8-4; b++){
if(aranan_matris[0][0]==matris[a][b]){
bulundugu_satir=a;
bulundugu_sutun=b;
for(c=0; c<3; c++){
for(d=0; d<4; d++){
if(aranan_matris[c][d]==matris[a+c][b+d])
bulundu=1;
else{
bulundu=0;
break;
}
}
if(bulundu==0)
break;
}
}
if(bulundu==1){
printf("\n Matris %d. satir %d. sutunda bulundu.\n", bulundugu_satir+1, bulundugu_sutun+1);
return 0;
}
}
}
if(bulundu==0)
printf("\n Matris bulunamadi.\n");
return 0;
}[/b]