return code of a process

two programs A and B writting in c++
I am using A to B and I want to know the return code of B.
in B
------------------------
int main()
{
return 11;
}
------------------------

in A
------------------------
int main()
{
system(A);
}
------------------------

Is it the right way to call B if I want the return code? If it is not, How?
Thanks a ton

Please read rule 4 (and the others)