string output problem

I'm trying to make a program that outputs a parabola. The user inputs the variables, and it's supposed to output blank spaces for where the points are, and sharp signs for points not on the graph and it's supposed to skip lines after 20 characters are put in. However, it only outputs the sharp signs and it does not skip lines. Here's the code for outputting the graph:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
int placement()
{
    //loops until all rows are filled
    for (parse = 0; parse < 400; parse++)
    {
        int j = 0;
        int k = 0;
        if (j < 19)
        {
            if (output[j][k] == ' ')
            {
                cout<<output[j][k];
                j += 1;
            }
            else
            {
                //doesn't matter if it is a space or a sharp sign
                cout<<output[j][k];
                j += 1;
            }
        }
        else if (j == 19)
	{
            j = 0;
            cout<<string(1, '\n');
            k += 1;
        }
    }
}
Last edited on
Your if-else on lines 10-20 is a bit unnecessary because both the if part and the else part do the exact same thing, but that shouldn't be a problem though.

Are you sure that output contains a "sharp sign"?
do you have any additional code?
because output and parse are not defined here.
also you function is supposed to return int but it doesn't return anything.
Last edited on
Topic archived. No new replies allowed.