Ok, so heres the thing.

Firstly I use windows operating system and the Borland C++ software.

My program has to do the following:-
1> Open a source code, which is in .cpp format.
2> Monitor the flow of execution and print a message for every occurrence of a semicolon [;]
3> Write the same to a text file.

I have a good idea about file handling and hence the third part is no trouble.

For the first part i am not sure if i have to use "system" command or "exec" command etc..

And lastly I have no idea how to do the second part. How can i monitor an execution of a program.

Example of my problem:-

If my source code is:-

void main()
{
  clrscr();
  int a=5,b=3;
  if(a>b)
    cout<<"a is greater";
  else
    cout<<"b is greater";
  getch();
}

so my program should execute this or run this or do anything to get the output:-
Line 1 is executed
Line 2 is executed
Line 4 is executed
Line 7 is executed

It should not say "Line 6 is executed", as it never has been.

The Art of C++ was a great book; regardless, perhaps you should turn it into a crude compiler that puts it into MASM32 mnemonic, or some other flow of choice.

This article has been dead for over six months. Start a new discussion instead.