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:

Edited by Vasthor: mumbling around!

6 Years
Discussion Span
Last Post by deceptikon

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, ' ');
Votes + Comments
thnx for the second method!
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.