The terminal works fine while running my previous codes except the recent one. Most likely there's some error in my code but I tried running the same in an online compiler and it worked just fine.
Here's the screenshot of the terminal:
Here's my code:
#include<bits/stdc++.h>
using namespace std;
void stair_search(int a[][1000], int row, int col, int k){
int i=0, j=col-1;
while(i < row and j >= 0){
if(a[i][j] == k){
cout<<k<<" found at "<<i<<", "<<j<<endl;
return;
}
if(a[i][j] > k){
j--;
}else{
i++;
}
}
cout<<"Element not present!"<<endl;
}
int main(){
int a[1000][1000];
int row, col;
cin>>row>>col;
// Take input
for (int i=0; i<row; i++){
for (int j=0; j<col; j++){
cin>>a[i][j];
}
}
stair_search(a,row,col,16);
return 0;
}