when i first learned how to use functions, it opened up a new world to me in C++. and the concept is surprisingly simple.

lets say you want to do this:
Code:
while ( x <= y ){
  if ( x <= 10 ){
    x = x + 2;
    y = y + 1;
  }
  else if ( x > 10 ){
    x = x + 3;
    y = y + 1;
  }
}
15 times within your program. no one wants to type that, or even copy and paste it, 15 times. so instead of having to write it more than once, you just define it as a function:

Code:
void testX() {
 while ( x <= y ){
   if ( x <= 10 ){
     x = x + 2;
     y = y + 1;
   }
   else if ( x > 10 ){
     x = x + 3;
     y = y + 1;
   }
 }
}
now everytime you want to put that whole formula in your code, instead of writing out the whole thing, you put:

Code:
int main(){
  //...
  testX();
  //...
}
saving you both time and effort. hope that helps.