It's not just a matter of implementing 3/(s+3) directly.
You need to discretize it to the z-domain using an appropriate technique (forward euler, backward euler, tustin, zero-order hold) then implement the discrete version of the filter.
The following would be a simple version for the Tustin transformation.
As written, the state needs to be initialized and stored somewhere externally to this function.
double firstOrderLag(double input, double coeff, double dT, double *state){
// Function to implement the discretization of a continuous time first
// order lag sys = coeff/(s+coeff) using the Tustin (Bilinear) transformation.
double num = (1/(1+2/coeff/dT)); // numerator
double den = (1-2/coeff/dT)*num; // denominator
double temp;
double output;
temp = input - den*(*state);
output = num*(temp + (*state));
*state = temp;
return output;
}