hello guys am trying to search a specific value in my matrix if its der than output value is in matrix if not output value is not in matrix...........but my code is not working plzzzzzzzzzzzzzzz help me
#include <iostream>
#include <fstream>
usingnamespace std;
int searchmatrix(int x,int y)
{
ifstream infile("input.txt");
int arr[20][20];
infile>>x;
infile>>y;
int i,j;
//////////////////////////////////////////infiling to text file
for(i=0;i<x;i++)
{
for(j=0;j<x;j++)
{
infile>>arr[i][j];
}
}
////////////////////////////////////////////search mtrix
for(i=0;i<x;i++)
{
for(j=0;j<x;j++)
{
if(arr[i][j]!=y) return 1 ;
}
}
}
int main()
{
int x=0;
int y=0;
int flag;
flag=searchmatrix(x,y);
if(flag)
{
cout<<"value is in matrix"<<endl;
}
else
cout<<"value is not in matrix"<<endl;
return 0;
}