Running a simple C++ code inside root

Hi, root experts
I would like to run the following script mycpp.C inside root

#include <iostream>  
#include <string>  
#include <vector>  
#include <bitset>  
#include <cstring>   
#include <stdexcept>   
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
   
using std::bitset;  
using std::vector;  
using std::cin;  
using std::endl;  
using std::cout;  
using std::string;  
using std::overflow_error;  
int main(int argc,char **argv)  
{  

  if(argc!=3)  
    {  
      cout<<"Please use 3 parameters"<<endl;  
      return -1;  
    }  
  cout<<"Their sum is: "<<atof(argv[1])+atof(argv[2])<<endl;  
      
  
  return 0;  
}  

Outside root, it is easy to run the code:
g++ myfun.C -o myfun
./myfun 1 2
The sum is 3

But I do not know how to run it inside root.
Could sb. give me some hints?
Cheers
Wenchao

Hi,

Use [code]#include
#include
#include
#include
#include
#include
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

using std::bitset;
using std::vector;
using std::cin;
using std::endl;
using std::cout;
using std::string;
using std::overflow_error;
int mycpp(float arg1, float arg2)
{

cout<<"Their sum is: "<< arg1 + arg2 <<endl;

return 0;
} [/code]
and run (for example, please see the User’s Guide for many other options):root.exe -b -l -q 'mycpp.C(1,2)'

Philippe.