Ariana
It’s cleaner that way
Vitaliy ◀️TriΔng3l▶️
So you don't have to write done = true; break; every time you want to exit it
Francisco
Not necessarily, but it helps when you have multiple exit conditions in the inner loop
I insist that very deeply nested loops should be reconsidered
Ariana
Especially when the loop condition is some weird thing
Ariana
I insist that very deeply nested loops should be reconsidered
how would you unnest say tensor multiplication
Mat
Sometimes 2-level, sometimes 3-level
I consider 3-level loops too nested already
Vitaliy ◀️TriΔng3l▶️
It’s cleaner that way
With goto or without?
Vitaliy ◀️TriΔng3l▶️
Yes
Francisco
Vitaliy ◀️TriΔng3l▶️
done = true; break; is two statements, one of which is even misleading because break implies breaking out of the inner loop, not the outer ones
Mat
Especially when the loop condition is some weird thing
If it is weird, it's not clear enough🤔
Vitaliy ◀️TriΔng3l▶️
goto is a single complete statement that states your intentions precisely in this case
Ariana
If it is weird, it's not clear enough🤔
Like tree->node[0]->child->node[0]<4 or smt
Mat
Like tree->node[0]->child->node[0]<4 or smt
I'd never put something like that inside an if statement😅
Ariana
i do worse things 😛
Vitaliy ◀️TriΔng3l▶️
Real life makes you have to do that
Mat
i do worse things 😛
Till you work alone on your code i presume noone will question you
Mat
Real life makes you have to do that
Nope. Programmers make that, not real life
Francisco
Real life makes you have to do that
I wouldn't do that stuff. At least I'd encapsulate that behaviour in a function
Vitaliy ◀️TriΔng3l▶️
I wouldn't do that stuff. At least I'd encapsulate that behaviour in a function
With a very specific name that will only be used in one place?
Vitaliy ◀️TriΔng3l▶️
That's spaghetti code
Vitaliy ◀️TriΔng3l▶️
Moving one condition from one place to the global namespace
Mat
With a very specific name that will only be used in one place?
Do you mean a clear name that will let others understand what's happening?
Vitaliy ◀️TriΔng3l▶️
Francisco
I think we disagree in the way we program. I prefer more of a declarative style rather than lots of deep loops
Mat
Comments need to explain at a maximum why you wrote that stuff
Mat
Not what's that stuff
Mat
Code should be self-explaining
Mat
As programmers, we pass enough time reading code. Let's not make this need hard
Francisco
Code should be self-explaining
Couldn't agree more
Dima
Code should be self-explaining
just like Carmack's fast inverse square evil root code
Roxifλsz 🇱🇹
just like Carmack's fast inverse square evil root code
// evil floating point bit level hacking // what the fuck?
Roxifλsz 🇱🇹
Anonymous
Ok🙂
Vitaliy ◀️TriΔng3l▶️
just like Carmack's fast inverse square evil root code
Just like his and Abrash's software renderer? https://github.com/id-Software/Quake/blob/master/WinQuake/d_draw.s
Ибраги́м
Lambdas: From C++03 to C++20, Part 1 https://www.bfilipek.com/2019/02/lambdas-story-part1.html https://redd.it/auwicw @r_cpp
Anonymous
Thank You! Alright!
Vk
Vk
Can anybody help regarding
Vk
This problem
Vk
So please..
Francisco
What have you tried so far?
Vk
I didn't recognize
Vk
It
Francisco
Well, then understand that I'm not going to do it for you
Yiii
hello. i like to ask for help about c++ basic coding using devc++. i write a code and it will prompt "do you wish to continue [Y/N]" entered 'Y' will go back to main() ; and if entered 'N' will be auto close cmd( is it possible)? i want to know is there a way to do that?. *yes i been google so far and yet not found the answer that i seek whether is it possible or not. #sry for bad english. ty
Francisco
Please help me if you understood
I'm doing other stuff, don't feel like reading problem statements
🐰🐾 سمیه
Hi. Would you please explain the highlighted part?
Anonymous
🤔
🐰🐾 سمیه
Why 😢
Anonymous
Hi. Would you please explain the highlighted part?
ok , As I used EOF , This will recieve input until value = null or The end of value . This line is very good but by change getchar() by fgetchar() to Read files . search for EOF value in google .
Luigi
Is there a way to put rand() numbers in an adder? I have a "sum" adder, i want to add all the numbers got from rand() in my "sum" adder, how can i do that? Sum=sum+???
Anonymous
EOF, getc() and feof() in C https://www.tutorialspoint.com/eof-getc-and-feof-in-c
🐰🐾 سمیه
Ok thanks 👍🌹
Anonymous
سميه
🐰🐾 سمیه
Luigi
Sum +=sum
Doesn't work
Luigi
I set sum equal to 0, and it remains equal to 0
Luigi
Luigi
.
Anonymous
Generate random number and store it in a variable say r_no Then sum +=r_no
Luigi
How do i store them in a variable? Ahah
Ariana
rand() outputs a number
Luigi
Yeah i know, and there's no way to put them in an adder?
Luigi
Not manually, of course
Anonymous
How do i store them in a variable? Ahah
r_no = rand() This should work
Luigi
Mh and can i output those numbers 1 by 1?
Luigi
I mean, i can do: r_no = rand() and cout << rand()