Electric Flux, denoted as Fe (Phi sub e) is a quantitive measure of the field lines traveling through a given Gaussian surface. This is evaluated so ANY surface surrounding the charge will have the same electric flux, and we can determine the enclosed charge by simply knowing the electric flux.

Taking the most complicated case first, we will measure the electric flux through an arbitrary surface A curved in three dimensional space. We pick a small segment of this surface, delta A, so small that it is practically flat. This forces us to make this surface infinitesimally small. Remember this.

We find the normal to this plane (the vector sticking directly out of it, forming a ninety degree angle to it) and call it n.

    _.-`    |         
 .-`        |            
|           |
|           |
|     ==========> n
|     -._ø  |
|        `-._
|           |`> E
|           |   
|           |
|           |  ø is the angle between n and E
|     __.--` 

The charge leaving the surface, E is only measured in relation to the normal of the surface. This makes up for the fact that a surface at an angle with the charge will be larger than one perpendicular to it.

|  ==> |       |    ø\
|      |       | ==>  \
| ==>  |       |       \   _.-n
| E==> |--n    |        \-`ø
|      |       |  ===>   \
|      |       | ==>      \
|      |       |           \
        A                   A`
Since both of the charges are the same, the flux ought reflect that. (I also added the normals -- note that the angle under the normal is the same as the angle on top.)
E * A == E * A (cos ø).

Fe is then the Sum of (E · n) dA. Since the we're dealing with a very constrained dot product, we can express this as the sum of (E cos ø) dA. Since we took our area as infintesimally small, we can arrive at the total of our surface by integrating over the area of our surface.

Fe = Closed Integral of (E · n) dA

To arrive at the net charges leaving an enclosed area, we sum up all the sides surrounding it. In a cube, we would have:

Fnet = Ftop + Fbottom + Fleft + Fright + Ffront + Fback

Of course, if there are more charges entering one side than exiting it, the flux of this side will be negative. The same applies to the overall surface.

Once we found the Flux, we can determine the enclosed net charge by multiplying it by (8.85 x 10-12 C/NM2), which is (4 * pi * K)-1.