如何对txt文件中的复数数据进行处理?

在处理大型复数稀疏矩阵时,需要将一系列存于.txt文件中的复数数据传入程序中,可以分别按实部和虚部存入两个double型的数组中,也可以直接将复数传入一个complex的数组中,具体复数格式如下图,不知道应该如何操作,求解答!(c语言或c++实现)

img


    FILE* fp = fopen("D:\\1.txt","r");
    if (fp == nullptr) {
        cout << "file open fail";
        exit(1);
    }
    double sb, xb;
    fscanf(fp, "%lf%lfi", &sb, &xb);
    fclose(fp);
//类似于此
FILE* fp = fopen("D:\\1.txt","r");
    if (fp == nullptr) {
        cout << "file open fail";
        exit(1);
    }
    double sb, xb;
    fscanf(fp, "%lf+%lfi", &sb, &xb);
    fclose(fp);