Tiles(File Allocation)

#include <iostream>
using namespace std;
int main() {
  int a,b;
  int ar[a];
  cin>>a;
  for(int i=0;i<a;i++)
  {
    cin>>ar[i];
  }
  cin>>b;
  int j=0;
  cout<<"Sequential file\n";
  for(int i=0;i<a;i++)
  {
    if(ar[i]==b)
    {
     j=i;
      break;
    }
    else 
    {
      j=j;
    }
  }  
	cout<<b<<" found at location "<<(j+1);
	return 0;
}
//code by lakshay singhwal

Leave a comment

Design a site like this with WordPress.com
Get started