How read / write on interactive C++ problems?

In a problem we have:
Input
T-the number of test cases
N,A,B-length of array and A+B=N (A and B can be 0)
x1,x2,...,xN - elements of array(integers)

Interaction
User read input, then write N integers.(calculated using dates of problem)
Judge react of this and write N integers, then user read this N integers written by judge (this numbers not is in initial input)
User write A integers.
Judge write B integers and user read this.
(--this happend for all tests of input--)

Give me a code C++ for read/write this dates on ineractive problem! Thanks!