请问这个代码怎么写,完全不会呀(语言-c++)

![img]

  1. (https://img-mid.csdnimg.cn/release/static/image/mid/ask/83122812184611.jpg "#left")
    c++模拟python的print函数的用法,每组输入包含两行
    第一行是a、b、c三个整数,空格隔开
    第二行的开始是一个数字(0、1或2)表示后续参数个数。如果是0,表示无后续参数,分隔符和行尾符都使用默认参数;如果是1,后面将跟随输入要使用的分隔符,而行尾符用默认参数;如果是2,后面将跟随输入要使用的分隔符和行尾符。【多组输入】
#include <iostream>
#include <sstream>

using namespace std;

void myPrint(int a, int b, int c, char sep = ' ', char delim = '\n')
{
    cout << a << sep << b << sep << c << delim;
    if (delim != '\n')
        cout << '\n';
}

int main()
{
    string line1, line2;
    while (getline(cin, line1) && getline(cin, line2))
    {
        istringstream ss1(line1);
        int a, b, c;
        ss1 >> a >> b >> c;
        istringstream ss2(line2);
        int n;
        ss2 >> n;
        if (n == 0)
        {
            myPrint(a, b, c);
        }
        else if (n == 1)
        {
            char sep;
            ss2 >> sep;
            myPrint(a, b, c, sep);
        }
        else if (n == 2)
        {
            char sep, delim;
            ss2 >> sep >> delim;
            myPrint(a, b, c, sep, delim);
        }
    }
    return 0;
}