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.
35 messages · Page 1 of 1 (latest)
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
Your message appears to contain screenshots but no code. Please send code and error messages in text instead of screenshots if applicable!
what exactly, is that supposed to be a string that looks like that or a vector of vectors or sort a vector of vector?
you are supposed to print triangle numbers?
i dont have idea our topic is loop something i think its a string
print like [0] and so on
do you know the formula for those numbers?
aithmetic?
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';
}```
for loop is much easier yes
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
also you shouldn't just tell someone the solution like this
whyh ?
whyh?
pff
pff?
where did this come from
what ?
i see a bit very close
why did you just become mad at me?
by the current looping index*
do you have idea how to put this inside the brackets?
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';
}```
thank you
@iron turtle Has your question been resolved? If so, run !solved :)
!solve
Thank you and let us know if you have any more questions!
!solved
Message is already solved