Please Help me

when i'am make a script for input and out file with code :
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main(){
int i,j,k,l,m,a,n;
int search;
bool found;
ifstream reader("work.txt");
if(reader.is_open()){
cout<<"How Many Number : ";
cin>>n;
int data[n];
for(i=0;i<=n;i++){
cout<<"Data "<<i<<":";
reader>>data[i];
cout<<data[i]<<endl;
}
int temp;
for(i=0;i<=n;i++){
for(j=0;j<=(n-1);j++){
if(data[j]>data[j+1]){
temp=data[j];
data[j]=data[j+1];
data[j+1]=temp;
}
}
}


cout<<" data sorting :"<<endl;
for(i=0;i<=n;i++){

cout<<data[i]<<endl;
}


cout<<"\nSearch Data ";cin>>cari;
for(i=0;i<=n;i++){
if(search==data[i]){
found=true;
cout<<"Data to Be in Index :" <<i;break;
}}
if(found==false){
cout<<"Data data not found ";
}
}
else{
cout<<"\nRead file eror!!";
}
reader.close();
cout<<endl;
system("pause");
return 0;

}

when I enter a lot number exceeds the available data, the error occurs

What kind of error ?
sample on file "work" there are numbers 1,3,4,5
when I input a lot of data over error...
Topic archived. No new replies allowed.