I'm doing a people counting program. I want to count how many people going into a building and coming out of the buliding.

I'm only managed to do the counting of people going in. Can someone help me. i want to to count how many people going in and in the same time count how many going out and show me the result of people going in and going out.

my program and procedure is below:

You take a laptop.
Open up notepad (assume you are uisng windows).
Sit and watch the passage way. Everytime a person enters hit the '1' key.
At the end of the day save the notepad file as cor.txt

Then run this program:

Code:
 
#include <iostream>
#include <fstream>
#include <algorithm>

struct all  {   bool operator()(char) const {return(true);}};
int main(int argc,char* argv[])
{
   std::ifstream  f("cor.txt");
   int count = std::count_if(std::istreambuf_iterator<char>(f),std::istreambuf_iterator<char>(),all());
   std::cout << "People Entering corridor = " << count << std::endl;
   return(0);
}
can someone help me or got other program that suit this problem.
thanks....