#how to make this kind

35 messages · Page 1 of 1 (latest)

celest anvilBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

#

@iron turtle

Screenshots!

Your message appears to contain screenshots but no code. Please send code and error messages in text instead of screenshots if applicable!

quartz grove
#

what exactly, is that supposed to be a string that looks like that or a vector of vectors or sort a vector of vector?

grand cape
#

you are supposed to print triangle numbers?

iron turtle
iron turtle
grand cape
#

do you know the formula for those numbers?

iron turtle
#

aithmetic?

deft solar
#

int main()
{
    unsigned int result = 0;
    unsigned int count = 10;

    for (int i = 1; i < count; ++i)
    {
        std::cout << result << '\n';
        result += i;
    }

    std::cout << result << '\n';
}```
#

i suggest you tu use for loops tho

#

int main()
{
    unsigned int result = 0;
    unsigned int count = 10;
    unsigned int i = 1;

    while (i < count)
    {
        std::cout << result << '\n';
        result += i++;
    }

    std::cout << result << '\n';
}```
grand cape
#

for loop is much easier yes

deft solar
#

Basically what it does is:
loop an amount of times each time it increment a variable of the current index

#

in the example that you showed it did 10 times

grand cape
#

also you shouldn't just tell someone the solution like this

grand cape
#

whyh?

deft solar
#

pff

grand cape
#

pff?

deft solar
#

jealous ?

#

poor guy

grand cape
#

where did this come from

deft solar
#

what ?

grand cape
#

why did you just become mad at me?

deft solar
iron turtle
deft solar
#

int main()
{
    unsigned int result = 0;
    unsigned int count = 10;
    unsigned int i = 1;

    while (i < count)
    {
        std::cout << '[' << result << ']' << ' ';
        result += i++;
    }

    std::cout << '[' << result << ']' << '\n';
}```
iron turtle
#

thank you

celest anvilBOT
#

@iron turtle Has your question been resolved? If so, run !solved :)

iron turtle
#

!solve

celest anvilBOT
#

Thank you and let us know if you have any more questions!

iron turtle
#

!solved

celest anvilBOT