Hey guys,

probably no programming for a long time (around 3 days), I lost myself on this, the dent_space1(max_space1, ' ') just not compiling, for its format. if so, how can I 'delete space' for the sake of this task?

4-2. Write a program to calculate the squares of int values up to 100. The program should write two columns: The first lists the value; the second contains the square of that value. Use setw (described above) to manage the output so that the values line up in columns.

        if (counter == upstage1)
        {
            upstage1 *= powerof;
            max_space1 -= freespaces;
            dent_space1(max_space1, ' ');
        }

P.S. this new "article writing format" just don't fit well with me. D:

Recommended Answers

All 3 Replies

what is dent_spacel() ?

oh, sorry, cut too much of the code, it's string btw. I'm trying to applying this code.

std::string z(n, c);

A constructor may only called during a declaration (under normal circumstances), so your code should look like this if you want to reset the dent_space1 string object:

dent_space1 = std::string(max_space, ' ');

Or since the object already exists:

dent_space1.assign(max_space, ' ');
commented: thnx for the second method! +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.