i have the integers 100 5 5 9 in my array numbers.But when i compile this program i get 2009312941!! Please help me

int main()
{ 	   
   	
   int numbers[4];
   int i;
    
    ifstream streamin;
   
    
   
    streamin.open("input.txt");
    for(i=0;i<4;i++)
   	{streamin >>  numbers[i] ;
        
    }
    cout << numbers[i];
    streamin.close();
int main()
{ 	   
   	
   int numbers[4];
   int i;
    
    ifstream streamin;
   
    streamin.open("input.txt");
    for(i=0;i<4;i++)
    {
       streamin >>  numbers[i] ;
    }

    // what is the value of i at this point?
    cout << numbers[i];

    streamin.close();
}

i think i=3 at that line..:-/

Look at the for loop's condition
for(i=0;i<4;i++)
i.e. "i" is not less than four at that line.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.