Disclaimer : I don't do C++
You should tell us what language you are using, and before asking a question that you yourself point as a newbie qustion you shoud search first, young padawan.
If it's java then check this : https://docs.oracle.com/javase/tutorial/java/nutsandbolts/if.html
But in many languages this should do :
if(temp<0){
//do something
}
For C++ : http://www.cplusplus.com/doc/tutorial/control/
Iteration in C++ : http://en.cppreference.com/w/cpp/language/range-for
or if you want to use the foreach : http://en.cppreference.com/w/cpp/algorithm/for_each
Here is an answer found on SO that should help : https://stackoverflow.com/a/16504109/4088809
looks like what you nee is
for(<type> <name> : <collection>) { ... }
if your list is contains int then
for(int i : vec) {
if(i<0){
// do your thing
}
}