小编PSK*_*PSK的帖子

无法理解iostream错误

我在一个程序中使用这个类复杂来解析方程

class complex
{
    double real;
    double imag;
    stringstream complexStr;

public:
    complex(double re = 0, double im = 0)
    {
        real = re;
        imag = im;
        complexStr<<real<<"+j"<<imag;
    }

    complex(complex &t)
    {
        real = t.real;
        imag = t.imag;
    }

    void StrtoComplex(char *temp)
    {
        int i;

        for(i = 0; i < strlen(temp); i++)
            if(temp[i] == 'j' || temp[i] == 'i')
                break;

        real = atof(temp);//takes till the last valid char so after + or whitespace it ignores
        imag = atof(temp + i + …
Run Code Online (Sandbox Code Playgroud)

c++ iostream

0
推荐指数
1
解决办法
160
查看次数

标签 统计

c++ ×1

iostream ×1