Question: says it all really in the title I have this javascript 

```
<script>          
$(".tile").click(function(e){
 $(this).toggleClass("flipOutX")  ; 
})
</script> 

```

I have some html dfined boxes called "tile" and the problem here is that when i click an individual tile the flipoutx function works but only the tile I have clicked.... 

How can I make this work for all my tiles that are all called "tile" and not just the one tile I have clicked ?

Answer: 
You need to size the vectors accordingly before accessing elements. You can do that on construction, or using `resize`.

`vector<int>values(5/*pre-size for 5 elements*/);` and similar for `values2` would fix your problem.

Currently your program behaviour is undefined.

If you want to subtract *adjacent* elements, then shouldn't you have `values2[i]=values[i+1]-values[i];`?
The line of code:

```
values2[i]=values[i+1]-values[0];

```

will take the looked-at element away from the first element each time.
Did you mean:

```
values2[i]=values[i+1]-values[i];

```

?