Guys, c++ is fucking my shit up

Guys, c++ is fucking my shit up

I'm taking intro to computer programming, and we're learning c++. At first, I thought it was going to be an easy class; the concepts seemed simple enough. However, over the last week, the difficulty has kind of ramped up. We're now going over functions and series, and I feel like I'm way over my head. I mean, I understand the code, but when I have to code something, I don't know what to do.

How do I git gud? I gave a fucking test on monday, and I have 3 days to unfuck my shit

Other urls found in this thread:

mathworld.wolfram.com/MaclaurinSeries.html
blogs.ubc.ca/infiniteseriesmodule/units/unit-3-power-series/taylor-series/the-maclaurin-expansion-of-cosx/
twitter.com/SFWRedditGifs

drink this

>Functions and series

please explain me what is a serie in C++...

Considering it
Well my professor wanted us to calculate values for cos(x) using its maclaurien series, and we had to use for and while loops to do it. Honestly I'm still a bit confused on how to do it...

Programming is easy just fucking kill yourself already

>retards that don't understand basic calculus concepts
lmao

Thanks for the support famalam, appreciate it

Codecademy. Do the python course in a day. Easily pass your test.

No problem, now drink the bleach

Take it easy man. Programming is easy after you've fully grasped the concept of its parts. At first it starts easy with for/while loops and stuff and then you get into private/public classes and friends and polymorphism and the shit is super confusing until you can finally wrap your mind around it and after that its all a walk in the park.

Read the fucking textbook and do some exercises? You can apply this advice to anything you have to learn in uni

That's cause you probably had a Calculus 2 prerequisite. Where they teach maclaurien series

I don't have time tho, I got a bunch of homework plus another test on Tuesday I got to study for.
Hopefully, man.
Literally going to do that after I finish my calc homework.
Nah, I'm in calculus 2 right now so that can't be it. I took BC though so I'm not totally in the dark, but I feel bad for the people taking calc 1 and doing this stuff

>Calc 2
>College

The fuck high school did you go to that teaches calc II? That is not a common goddamn thing.

It's probably some sperg that thinks he's hot shit for taking BC and getting credit for it

Seems like you've never worked on s real world project

mathworld.wolfram.com/MaclaurinSeries.html

That shows you how to calculate cosine using a maclauren series.

As far as writing the function, I'm not going to walk you through that because it's extremely basic shit. Ask your professor for help. This isn't high school, profs are actually there to teach you. I will tell you that you need to call a function that has a decrementing for loop.

If Calc 2 is not a prereq then they *should* explain how the maclaurin series works in this case.

If not: cos(x) = 1 - x^2/2! + x^4/4! - x^6/6! + x^8/8! - x^10/10! + ...

a^b being a to the power of b, not what C++ uses ^ for which is XOR.

Basically this thing: blogs.ubc.ca/infiniteseriesmodule/units/unit-3-power-series/taylor-series/the-maclaurin-expansion-of-cosx/

TIP: Group like so: (a - b) + (c - d) + (e - f) + ...

Damn. I thought I was an underachieving retard but at least I wasn't like this. Thanks OP.

int ft_fibonacci(int index)
{
if (index < -1)
index = -1;
if (index < 2)
return (index);
return (ft_fibonacci(index - 1) + ft_fibonacci(index - 2));
}


Fibonacci in C, recursion helps for series.
I have an iterative exemple for the collatz conjecture if you want.

Holy fuck man, just googled that shit, looks pretty awful. Now i remember why I went into IT.

If you score well on the ap you can place out of calc 1 and 2 retard

>functions and basic control structures are difficult
Just get a job at McDonald's or something like that.

CS graduate here. I fully hate the concept of tests and think it is absolutely cancerous for computer science specifically. I went through my entire undergrad programming minimally and just memorizing for tests. This is so fucking bad for CS you wouldn't believe it, Jesus Christ. And you pretty much have to do it this way because tests are worth so much. To me it was " do I write this program which will take an indeterminate amount of time possibly fucking me over for the test, or do I just study for the test that I'm guaranteed to learn most of".

Fuuck that was so stupid, thank god its over.

>doing Fibonacci recursively
That's some bogosort-tier shit. Iterative solution is shorter, easier to understand AND faster.

bump

But at least you have a piece of paper which will raise the chance of being employed in an IT field.
Why do I have a feeling that everything outside natural sciences in universities is a God damn Ponzi scheme?

Learn the habit of taking concepts and putting them in code basically.

It sounds like what you want is practial exercises.

I can recomend /r/dailyprogrammer for fun exercises with problems often derived from other sciences to make it more interesting.

Also, dont worry about it, just keep pushing forward, it takes time to learn.

Good luck, user!