replace printf to cpp std iostream