Decide to learn C++

>decide to learn C++
>going well
>get to looping
>absolutely confused and brainlet.jpg

t-tell me it gets easier lads

Attached: 1407119379594.png (724x611, 129K)

Other urls found in this thread:

youtube.com/watch?v=1i4-e1okZtw
twitter.com/SFWRedditVideos

The fuck is looping

I have had more trouble understanding the need for header files. Holy shit is that backwards.

>t-tell me it gets easier lads
no

I think he means iteration. If you can't handle iteration OP, turn back now.

They're literally copy paste on compiler level

How the fuck is that confusing

>looping
>confused
>literally easiest concept with programming
Hah, what a joke.

If that confuses you, then you need to start off using something like Python first.

Attached: 330px-Gary_badges.png (330x338, 125K)

Loops are incredibly easy.

just keep at it OP, it'll click eventually

Just wait for generic programming, RAII and smart pointers

are you young? that's the only excuse.

he said "the need for"

I think the problem is most professors take this stuff for granted and tell you to do stuff without telling you why you're doing it, which makes things more confusing

I dont use c++ but

for(int i = 0; i < 5; i++){
print(i)
}

this means that as long as the index called "i" is lower than 5, it'll run the print(i) command inside the loop.

loops are like mini subroutines inside the main loop.

I'm questioning the existence of header files, not the concept of importing code through inherit/include.

where are you confused? the loop does the block of instructions repeatedly until certain conditions are meet

while(x < 10)
{
print("Faggot");
x++;
}


will execute until x is equal or larger than 10

same goes for
for(x = 0; x < 10; x++)
{
print("Faggot");
}

Attached: 1525257495271.jpg (1521x2057, 1.12M)

if this isn't bait:

looping is essentially telling a computer to perform a task for a number of times untill a requirement is met/not met

ie:

while(){
do shit
}

while it isn't apparent how flexible this can be from the start, looping can truely become magical, especially when you reach recursion

to go in more detail of why the for loop is structured this way

for(syntax to start loop)

(int i = 0) you're defining the starting index of the loop

(i < 5) how many times the loop should be ran

(i++) determine how the loop should be incremented

It's convention and convenient. You do your definitions all together so you can implement your code all together. Of course the C compiler preprocessor convention is complete shit and anti-header.

Loops are just branches with conditional jumps on machine level:
LABEL:
DO_SHIT
IF CONDITION GOTO LABEL


Once you get this, it should be much easier conceptually

you mean looping as in "for, while, do...while,goto" or as in "iterators and how the fuck do they work, probably wizards" ?

wrong! let me fix it for you

const bool OP(true)
while(OP)
{
print("Faggot");
x++;
}

>get to looping
Nigger that's step one.

your fucked. give up now

>this holy shit, I though c++ was not a big deal until I reached this level.

RAII is just common sense.

>(i < 5) how many times the loop should be ran
No, that's the end condition, in this case it's only true because the incrementation is +1 (i++), if it was i += 3 it wouldn't be true.

C++ as a language is easy to use compared to just how balls insane some APIs you will get to use are. Half-witted docs, stupidly complex build systems, the fact that nothing works on first try ever, an insane amount of misinformation by bad programmers and 300 pages of template errors.

Only way to go forth is to persevere. It's a long and thorny road but it's worth it. gl OP

How can it possibly go well before you get to the first step?

>decide to learn C++
>going well
>get to chapter 5 in the book I was reading
>almost time for finals and have to stop for studying

Attached: 1522098132062.png (671x519, 146K)

>It's [...] convenient
Now this is Stockholm syndrome if I've ever seen it.

It's a convenient convention covenant.

Looping and branching are bread and butter.
You're learning to be a gourmet chef.

It gets a lot harder. A lot lot harder. Understanding iteration is an insignificant step. It's like knowing how to breathe.

It's more like syntax sugar

for(x;y;z) {...}

is equivelant to

x;
while (y) {
...
z;
}

I think symbolic inclusion was already invented back then, so basically Kensington & Richard followed by Barney Starsoup fucked up. Another time.

>generic programming
sure go ahead duplicate all that code like C fags do

>RAII
it's very simple - put "new" statements in a constructor and put "delete" statements in a destructor

>smart pointers
it's automated RAII

But that just covers my console in OP

>falling for the loops, functions, classes, and templates memes
if and goto are literally all you need

Attached: graduate.png (759x801, 710K)

>Barney Starsoup

Attached: 1387822347430.jpg (678x297, 44K)

pointers and arrays are literally all you need

Because symbolic imports are 2hard.

How do I store key: value pairs where value can be anything I want? Is vector what I'm looking for?

std::map or std::unordered_map if the key is an arbitrary type. The performance is garbo though.

I'm struggling with polymorphism and design patterns.
Don't you guys wish you could just go back in time and learn c++ all over again?

It is not O(1)?

No.

the only hard thing about c++ is learning the fucking stl

true, but this is what makes C++ more usable than C

Casey Mororuriariatory (2015): Barney Starsoup++. Online at: youtube.com/watch?v=1i4-e1okZtw (accessed 2 may 2018)

No. How would that help?
Go visit gameprogrammingpatterns.com.

literally interfaces that are implemented exactly once.

it's like telling your secretary to type up the report twice because you need two copies.

Well its literally implemented twice for no good goddamned reason in place of documentation. It's also easier to link with a bad compiler.

What's confusing about it?
int function(int x){
int i ;
for(i=0;i

You’ll get it OP. Technology needs you

Just keep working on it.

Maybe switch and learn C first, I found C to be a very simple language (it has like 8 things you need to know).

You could say you've been thrown for a loop

I don't get it. Is this supposed to be an infinite loop?

>decide to learn C++
>going well
>get to windows API
>complete void brainlet

Attached: nene1.png (900x506, 596K)

>> Learning Python
>> Get to Lists and Dictionaries
>> Cant figure out for the life of me the use of these things

Why would I ever use these things?

>decide to learn C++
>going well
>try to understand how std::move works
>complete void brainlet

Attached: 1513863517193.jpg (420x673, 34K)

>decide to learn C++
>going well
>it increments as soon as I'm finished

Winapi is garbage.

std::move is pretty straightforward though

it's literally just std::static_cast

I felt the same way learning JS initially

You just have to break it down and read the code line by line and realize each thing that is happening and when according to the stack, then once you go inside a line you break it down for each individual command to that loop.

It makes a lot more sense if you have a decent teacher who actually knows what they are doing explain things. Pajeets on youtube are fucking terrible.

It's a loop creating new processes which each create one more process then its parent, then it prints faggoty things

Might as well just program in assembly then.

>std::static_cast
>compile-time cast to reference to reference of type
that's how I read this in my head

Still can't get into pointers

>needing if

Do you really need arrays if you have pointers though? You can line up your own contiguous memory.

Hello forkbomb