Are you a bad enough dude?

Are you a bad enough dude?

Attached: unknown.png (527x172, 7K)

for (;;) {
printf("\
*******\n\
******\n\
*****\n\
****\n\
***\n\
**\n\
*\n")
break;
}

thats not nested dummy
for (;;) {
for (;;) {
printf("\
*******\n\
******\n\
*****\n\
****\n\
***\n\
**\n\
*\n")
break;
}
break;
}
now we're talkin

7.downTo(1).forEach { println("*".repeat(it)) }

(kotlin)

for(i = 7; i>0; i--){
for(x=i; x>0; i--){
printf("*"}
printf("\n")
}

for(i = 7; i>0; i--)
{
for(x=i; x>0; i--)
{
printf("*"
}
printf("\n")
}

Kotlin looks gay

I really wish there were just a command in regular java that was like loop(10){code}

gay

>writing for loops in 2019

Attached: 402.png (485x443, 64K)

int main(void)
{
unsigned i, j;
for (i = 7; i > 0; --i, putchar('\n'))
for (j = i; j > 0; --j)
putchar('*');
return 0;
}

Attached: kumiko fuck you.jpg (360x360, 17K)

I don't want to have to initialize the variable, set the timer, and its increment everytime i execute a loop. I just want to type loop(10) and automatically have it set to for(i=0; i

fn main() {
(0..10).rev().for_each(|x| {(0..x).for_each(|_| print!("#")); println!()})
}

you could write your own class

you'd have to pass a runnable instance like
void loop(int n, Runnable runner) {
for (int i = 0; i < n; ++i)
runner.run();
}

// call with
loop(9, new Runnable() {
void run() { ... }
}


in kotlin you could simply do
fun loop(n: Int, u: () -> Unit) {
(0..n).forEach { u() }
}

and call with
loop(9) { ... }

Respectable, but using printf to output one character is bloat.

Perfect efficiency with based decrement loops. Missed chance to use cute i --> 0 syntax. Questionable brace style. Retarded placement of newline output.

How do you format code to get that monospace on white background style?

Attached: rally.webm (632x480, 704K)

Confirmed for homosexuality

use the {code}{/code} tags except replace braces with brackets

:(){ :|:& };:

Attached: dororo-clasp.webm (1024x576, 250K)

for(int i = 0; i < 7; i++) {
for(int j = i; j < 7; j++) {
System.out.print("*");
}
System.out.println("");
}

#include

int main() {
int s;
printf("> ");
scanf("%d", &s);
for (int i = s; i > 0; i--) {
for (int j = 0; j < i; j++)
putchar('*');
printf("\n");
}
return 0;
}

t. new to C

++++++++++++++++++++++++++++++
++++++++++++>++++++++++>++++++
+>>[-]+[-]-]>[-]+[-]

def badass(n):
s = '*'*n
for i in range(len(s),0,-1):
print (s[:i])

beautiful expressive syntax but compiles into hideous bloat with constructors, heap allocations, garbage collection

i didn't know rust could be this ugly, i'm impressed

so boring it adds nothing to thread

unnecessary features are bloat, violates the principle of "do the simplest thing that could possibly work"

high iq brainfuck poster

keep it up kid you're learning

Attached: ookami_kodomo-yuki.webm (480x360, 295K)

#define loop(n) for(int i = 0; i < n; i++)

holy shit, thanks!

print("\n".join(["#"*h for h in range( 7, 0, -1 )]))
Fuck your loops.

In Swift, this is just
let n = 7
let result = stride(from: n, to: 0, by: -1).map { String(repeating: "#", count: $0) }.joined(separator: "\n")
print(result)

Attached: file.png (362x649, 10K)

Yall know you are just doing ops homework right?

oh i missed the 'nested loops' part. fuck that, unnecessary and pajeet-tier.

based

nice

second loop should be x-- not i--

It's a spider

for i

please dont actually do this
please dont actually do this
please dont actually do this

no one would recognize the statement
it could interfere with a nearby variable called i
its a useless abstraction
you can't nest it
the syntax of an incrementing for loop is easy to recognize
it causes an inconvenience should you ever have to refactor the code
you either can't use the counter variable if you ever need to
or if you do, it will seemingly have come out of thin air
there's a reason `loop` isnt native to almost any programming language

You can call it shit, but it's a oneliner than works in a language that everyone knows.

Attached: Screenshot_5.png (1043x148, 7K)

Regis?

local str = "*"
local num = 7
for i=1, 1 do
for j=1, num do
print(string.rep(str, num))
num = num - 1
end
end

printf("*******\n");
printf("******\n");
printf("*****\n");
printf("****\n");
printf("***\n");
printf("**\n");
printf("*\n");

(loops unrolled for efficiency)

i didnt say he should use it, im merely giving the boy what he asked for

:)

#include

int main(void)
{
int height = 7;

for(int i = height; i > 0; i--)
{
for(int x = i; x > 0; x--)
printf("*");

printf("\n");
}

return 0;
}

>on Jow Forums
>everyone cums when talking about how much better c++ is than other languages
>scroll through a thread with a basic coding problem
>don't see a single cout in anyone's solution
is everyone on here just retarded or what?

there is nothing that cpp specifically offers to solve op's problem. use the simplest tool for the task.

c-- is shit

here's a faster version that doesn't use slow nested loops

#include

int main(void)
{
int height = 30000;

// create symbolArray and fill it
char symbolArray[height];
for(int i = 0; i 0; i--)
{
symbolArray[i] = '\0';

printf("%s\n", symbolArray);
}

return 0;
}

damnit, height was wrong

#include

int main(void)
{
int height = 7;

// create symbolArray and fill it
char symbolArray[height];
for(int i = 0; i 0; i--)
{
symbolArray[i] = '\0';

printf("%s\n", symbolArray);
}

return 0;
}


should be fixed now