Try all my life once every 5 or so years to learn programming

>try all my life once every 5 or so years to learn programming
>always fail when I reach loops
>told myself I would learn C finally and beat loops
>reach chapter that deals with loops
>"ok I understand them perfectly, I got this"
>suddenly become completely unable to solve programming exercises (except one or two)
is there some trick to going from "understanding loops" to actually creating loops that work or am I unredeemably too low IQ to learn programming languages?

Attached: 1516991136409.jpg (3840x1600, 2.12M)

Kind of thinking about killing myself at this point

Attached: 1517324021581.jpg (3360x1398, 255K)

bump

Attached: 1518136091055.jpg (5760x3840, 2.31M)

what's wrong with loops

is this bait

Are you one of these people that only focuses on thing sthey are clearly not good at to their own detriment, cos let me tell you bro stop that shit right now if you want to not end up a bitter husk of a human being

Attached: 1503404531461.jpg (488x432, 35K)

This is bait and you're a fucking faggot. Pointers I can understand, but loops aren't even complicated.

user why are you learning to code in the first place?

Follow tutorials till something click. Buy some of those programming books meant for kids and learn an easier language lmao.

maybe I really need to kill myself

I understand them, it's just that I can't solve exercises

>am I unredeemably too low IQ to learn programming languages?
Signs point to yes

If you think C is hard you should give up

Post the exercise you're having trouble with

>how do loops work
you're beyond saving, work at macdonalds or something you sub-10IQ retard.

Shit even that nigger tyrone knows how loops work.

this

>Programming Project 9 in Chapter 5 asked you to write a program that determines which of the two dates comes earlier on the calendar. Generalize the program so that the user may enter any number of dates. The user will enter 0/0/0 to indicate that no more dates will be entered
At this point I got how to do it, I looked for a solution. That said, I always make a mess where I get close to the solution but mess up tying it all up. So I look to the solution and I feel even dumber for being so close to the solution but being unable to complete it

Why are you so foccused on learning to code?

Attached: 1504107257901.jpg (296x418, 34K)

Hey user, I know you're IQ is too far off the chart to notice but the average person will think C is hard. If OP can't even do stuff past loops, might as well go back with Python and Javascript.

Just use recursion instead

I am not american, we are not lucky enough to have macdonald's handing out comfy jobs for dumb people to everyone

because I think it's cool, I like the idea of creating products just with my mind and some code

What exactly are you having trouble with though? That sounds pretty easy to me. FYI you do know your code doesn't have to look EXACTLY like the solution right? There are a lot of ways to write this. But post what you have so far

OP man, give it some time. Rome wasn't built in a day. But if programming really isn't your thing, there are other ways to create products with your mind and a computer. Get into graphic design or video editing, design websites man. Don't have to torture your poor mind if it really can't.

How the fuck is C hard?

Try fucking around on your own with what you've learned instead of trying to solve challenges. You learn quickly when you actually want to build the thing you're building

>Oh shit here's the syntax to do a for loop
>What can I make with a fucking for loop
>What if I wrote a program that looped over every number every number between 1-1000 and prints "OP's a faggot" when the number is divisible by 69

Do stupid shit like that and suddenly it'll makes more sense

Attached: jXI5V5q.jpg (1280x1079, 519K)

You need to go to college and major in computer science to really understand programming

#include

int main ()
{
int month, day, year, month2, day2, year2;

while (month != 0 && day != 0 && year != 0) {
printf("Enter a date (mm/dd/yy): ");
scanf("%d/%d/%d", &month, &day, &year);

if ((month + day + year) < (month2 + day2 + year2)) {
month2 = month; day2 = day; year2 = year;
}
}

printf("%d/%d/%d is the earliest date", month, day, year);
}

As I said I looked up the solution and realized I was quite close, but this was when I got frustrated and kind of gave up

Holy how low is your EQ.

C isn't hard, fuck I love C.

But anyone can see how a beginner can find it difficult compared to say Python or Javascript, especially if you're learning it on your own or from the wrong sources.

yeah I probably try to rush too much and get overwhelmed. I will try tinkering with loops for like 3 or 4 days and see it if gets better. Thank you for the suggestion.
My only worry is that if I need 4 days to get good at this, once I get to more difficult stuff it will be impossible.

I am reading C programming - a modern approach

Attached: 1517276432893.png (645x968, 108K)

If I fail completely I will try web developing, seems to be much easier

So you're tried, what, three times so far?

Skip loops. Go learn programming and write code for things without using loops. Or let this concept discourage you again, and waste a few more years, you miserable bastard

Attached: file.png (640x622, 540K)

OP do yourself a favour and get "starting out with C++", you can download it for free off the web. Yes it's a C++ book, but most of what they go over in the first half of the book is mostly C. If you read every chapter and do ALL the challenges at the end, I can promise you that you'll understand programming much better. You really just have to be patient and practice. It's like learning math in that sense.

loops are not even difficult and are rather basic shit
you are overcomplicating the matter, instead of simply accepting what they are
either that or you are a brainlet, and if so, should accept that and try dooing something else

if you only want a well paid IT job, try support/sysadmin instead.
if you really, honestly dislike tech in general, your life will be hell, so probably shouldn't be doing this. start selling expensive stuff on facebook or something

Also don't take it so seriously. It's not your job, it's just a fun hobby. So who cares if you don't really know loops yet? People here will laugh and jeer, but you're just writing code and having fun.

>try all my life once every 5 or so years to learn
what are you fucking depressed
what's keeping you occupied during those 5 years

no replies because everyone is actually bad at programming here

Attached: 1440185225241.gif (480x292, 3.48M)

Learn javascript man

I didn't reply because it was horrible.

There is a lot of shit that's wrong here
>The user is only entering one date
>You're comparing that one date to uninitialized variables
>There is no way of letting the user know how to end the loop
>You're allowing the user to enter virtually any number they want, even negatives

I'm probably missing some stuff but that's on first look

#include


int main()
{

int day1, day2, month1, month2, year1, year2;

printf("Enter a date (mm/dd/yy): ");
scanf("%d /%d /%d", &month1, &day1, &year1);

while (1) {
printf("Enter a date (mm/dd/yy): ");
scanf("%d /%d /%d", &month2, &day2, &year2);

if (day2 == 0 && month2 == 0 && year2 == 0)
break;
if ((month1 + day1 + year1) < (month2 + day2 + year2))
day1 = day2; month1 = month2; year1 = year2;
}

printf("%d/%d/%d is the earliest date", month1, day1, year1);

return 0;
}


I am OP, I fixed it

Yes I am depressed.
A lot of other endeavours where I fail miserably everytime

I will try it out, thank you user

if ((month1 + day1 + year1) < (month2 + day2 + year2))

wtf is this supposed to do ?
i mean even if you don't know shit about programming, think how a hooman would try to find if which date is earlier. Then try to create the program. Think about like writing a recipe for someone who hasn't cooked before.
At least i like that you try and that you seem to have a good taste on movies.

Coding is algebra and grammatic semantics. Its easy if you can do these.

It becomes hard when dealing with other peoples code or being asked to do something you have never attempted before. It is literally like learning a lnaguage except the language is usually autisticaly gramatical.

Think back to when you first learned to read and write, you tried your hardest for shit like "I went to the park" and "that is a dog"
Its the same shit, just embrace that you are at a babby stage right now.

At this point I think you're baiting, because this is a REALLY poor attempt. This looks like what someone would come up with half-assed at the last second for homework, only so that they don't lose all the points.

Did you learn structs yet?

>((month1 + day1 + year1) < (month2 + day2 + year2))

January 1, 11 AD < December 1, 1 AD

>"fixed it"
>it's worse
Opanon, I mean this in the kindest way, and please don't kill yourself,
but,


stop touching computers.
You are hurting them.
Maybe try being a gardener?
Plants are nice.

It finds which is the earliest date by adding the numbers that make up the date. A later date will always sum up to a higher number than an earlier date. Thank you user

The date is written mm/dd/yy so in your example it would be 11/1/18 < 12/1/18 and the code would work correctly

SeeI mean I understand you're new, but it honesty seems like you're just half assing here. Whatever fuck this, I already fell for the bait

SeeThank you user, your post cheered me up

How is it worse? It works flawlessly now

books are memes unless you reach a level of understanding where you start to develop more complex things aka design patterns.

Just pick a random C tutorial and start doing some exercises.

>all my life once every 5 or so years
So you've tried to learn programming three times?
>always fail when I reach loops
So each time you've spent about half an hour?
>is there some trick to going from "understanding loops" to actually creating loops that work
No
>am I unredeemably too low IQ to learn programming languages?
Yes

I fixed it for you.

Attached: 2018-08-24 08.40.40.jpg (3264x2448, 2.57M)

In the book I am reading loops are at page 120. How does a beginner get that far in half an hour?

Ah shit, i just realized it doesn't cover pre2000 dates.
Back to the drawing board.

You need a scanf outside the loop otherwise it won't work. You basically just added a nested if and got rid of my more concise way of evaluating the earliest date

>You need a scanf outside the loop otherwise it won't work.
Is this some C bullshit?

how retarded do you have to be to not understand something as simple as for loops?

seriously, if you can't handle that then don't even bother going any further. recursion would probably melt your brain.

Yes

I understand them, I just can't get them to work correctly when I am creating them ex nihilo to solve a certain problem

>got rid of my more concise way of evaluating the earliest date
Your method of evaluating earliest date doesn't work.
3/30/15 and 4/02/15. Which is earlier?

>Yes
Okay then put one outside the loop, but otherwise mine is mostly better. Dates pre2000 are an issue though that woukd be better solved by using yyyy input.

If you can't implement it correctly, then no you do not understand it. This is like saying "yes I understand algebra I just can't do it"

He doesn't get loops. They are the same fucking thing in JS. How would that help?

Just wait until you get to multi-dimensional arrays.

Attached: 1534896186072m.jpg (1024x576, 85K)

Except he's having trouble with the most basic concepts in fucking programming. How would switching to Python or JS help him? Loops are loops no matter what language you're using.

You mean 11/1/11 < 12/1/1, which is bullshit.

Bro are you fucking kidding me? Add 12 12 1 and 11 11 11, which is smaller? And your code still doesn't address putting in negative numbers

You can't have 12 12 1, you would write 12 12 12 which would be higher than 11 11 11

Who would write 1 as a year? Your bait is weak

His problem isn't loops, it's just straight up programming logic.

>making assumptions about what data wilk be input

And being a retard

>Who would write 1 as a year? Your bait is weak
The poster you replied to. It clearly says 11 AD and 1 AD, but you wrote the year as 18 for some reason.
Did the exercise limit the year a user can enter to 2000+? No it fucking didn't, so year 1 is valid, you absolute brainlet.

Why not? Once again nothing in there limits what anyone can input. I could write "1000/1000/8" or "0/0/-5000" or "opisafuckingfaggot" and nothing can stop me. I dunno if it's the book youre using that's shit or if you're just flat out dumb, but you have some serious work to do. It's obvious you don't even understand the most basic concepts. It has nothing to do with C or any other language.

OP, please stop baiting Jow Forums because you feel lonely. Head over to the /hum/ board on lainchan, people on there actually want to engage and help with that kinda stuff. Don't denigrate yourself if you cannot understand programming. There is something else for you somewhere out there. If you really want to work with computers, try networking (as in servers).

In the case that this isn't bait and you're just really lost :
Sketch out what the problem is first. Think about the tools that you have at your disposal (loops, control structures, variables etc).
If you cannot finish the exercise go back and look at these tools again. There is something you're not understanding.
What you posted here , is incorrect.
You can understood how to output and input data, but the core is not working like it should. According to your "date check" the last day of December in 1999 would be after today.
This has nothing to do with your structure or your loops, you've just not thought about the presented problem enough.
I have seen a couple people at uni that code like that. They're not thinking. I'm like that with higher level math too. Try evaluating if you're really present right now. Take a break.

Are "loops" a programmer lingo for some arcane complex procedure or are you talking about basic for and while loops? If so you're either trolling or retarded because I understood those perfectly when I was 4 and I'm not a programmer.

Ok, thank you user. Not b8ing btw.

He's baiting, but I don't give a shit because Jow Forums is extra shit tonight anyway

Fuck this thread reminds me of myself trying to learn any math. Being a brainlet is not fun user.

Attached: 1533832700998.jpg (590x550, 34K)

>In the book I am reading loops are at page 120
The book you are reading is for retards

I wonder what the first 119 pages cover.

>5 pages jerking off the publishing company
>20 pages table of contents
>20 pages of the author jerking himself and his friends off
>50 pages about how bits work inside of computer
>10 pages about how many bytes are in what datatype

Attached: rPtOlG95uBU.jpg (1280x720, 42K)

That's a good fucking question. I'm tempted to download this shit to find out.

But the guy said it like the preceding pages required some study too. Does anyone study the author's 30 pages of "why I set out on my quest to write this book and how my wife helped"?

Attached: Untitled.png (656x2360, 888K)

That's why beginners should stick to C programming 2nd edition. It's short, to the point, and you'll hit the ground running by the end of it

You could go through all of that in like 2 hours. Not a single thing there should take more than 10 mins to understand and implement

>that pen
>that penmanship
>that version of notepad

Attached: 1509396084731.jpg (550x336, 44K)

It all clicks at one point. Just keep going.

I don't understand how someone could not understand loops. Is the condition of the loop still true? Focus on everything between the brackets and execute from the top down. Is it false? Skip everything between the loop's brackets and continue down the code. If you have a debugger or use an IDE set a breakpoint at the beginning of your loop and step through it slowly watching the variables on your stack or how it returns from method and function until it makes sense.

Remember that the average IQ of your average first world country is about 100. That means half the population is below 100 IQ. Think about that for a while.

Although it's designed that way I doubt it follows a normal distribution with respect to low iq, people with 115 IQ are a lot more common than literal mouthbreathing 85 IQ retards.

if (year

>I doubt it follows a normal distribution
It does, though.

I mean in reality. I know it's literally designed to follow a perfectly normal distribution. Maybe I'm just projecting or something, or I'm biased to believe that it's skewed. It's pretty hard to swallow the idea that there's as many 85 IQ retards as mildly intelligent 115 IQ people.

I suppose if there are a lot more smart or retarded people then the test just gets restandardized and centred on 100 again.

Nah, you're biased. You're probably some university person who's mostly around the 100+ normalfag demographic and gets your worldview from your surroundings. The 85IQ's are just as many as the 115s, but you won't find them in adult education or in tech jobs. They're in their trailers or ghettos thinking mostly about things like whether McDonalds or Burger King is the better brand or whether wrestling is real.

>Programming Project 9 in Chapter 5 asked you to write a program that determines which of the two dates comes earlier on the calendar. Generalize the program so that the user may enter any number of dates. The user will enter 0/0/0 to indicate that no more dates will be entered
Requirements bad. Doesn't specify year format. If you're going with 2 digits this program cannot determine that a date occurring in any century is greater than or less than any other date in any other century. This is when you go back to your product manager and ask for clarification, probably the most important part of being a software engineer.

The format itself is irrelevant, there are ways around it for a beginner. I'm not 100% sure about this but couldn't you use getline anyway to get 00/00/00 format? Either way, the point of an exercise like that is to understand how while loops and if/else conditions work. That's the real issue here, it's that OP doesn't understand how those things work