Jow Forumsuys, how do I get addicted to programming? I like to program but...

Jow Forumsuys, how do I get addicted to programming? I like to program but, I always feel as if I don't know enough when I have a idea. Which leads to trying to read one of those dry programming books and I get bored and don't finish it.

Attached: Programming_challenges.png (1920x1080, 305K)

Other urls found in this thread:

pastebin.com/raw/m77Mbb1r
twitter.com/NSFWRedditGif

just try and get over the learning hurdle with a language and stick to it once you've learned it

>how do I go from one situation where I cannot control my actions to another where I cannot control my actions
lmao

smoke weed, get newbie linux distribution and start using vim. You need to get intimate with code, to immerse in it as in cool ocean during hot summer

Rolling

MoonScript:
answers = {"It is certain.", "Without a doubt.", "You may rely on it.", "Outlook good.", "Most likely.", "Yes, but do it drunk as fuck", "Yes.", "Reply hazy, try again.", "Better not tell you now.", "Cannot predict now.", "Concentrate and ask again.", "Dont count on it.", "My reply is no.", "My sources say no.", "Outlook not so good.", "Very doubtful.", "Absolutely not."}

math.randomseed os.time!
while true
io.write "Ask the 8 ball: "
io.read()
print answers[math.random 1, #answers]

>Which leads to trying to read one of those dry programming books and I get bored and don't finish it.
Try making it lead to Googling for help for your specific problem, followed by copy-pasting from Stack Overflow.

>Which leads to trying to read one of those dry programming books and I get bored and don't finish it.
Those aren't meant to be read completely. Just look up how to do X when you get stuck on X.

Buy a thinkpad
Install arch
Use vim

>MoonScript
Why do people use obscure and quirky languages? C is a great and powerful language.

because i want to

Yes, but why? Just to be different? You could describe me as eccentric, but I think it's kind of stupid to do things different for the sake of being different.

because it's fun

Fair enough.

Rolling

ROLLING haha

rrrrrrrrrrrrrrrrrrrrollin

roll

Roll

#include
#include

int main(){
char str[] = "Green is my pepper, OP is a faggot \n";
printf("%s", &str);
int words = 0;
for(int i = 0; i < strlen(str); i++){
if(str[i] == ' ' && (str[i + 1] != ' '))
words++;
}
printf("Number of words: %i \n", words);
}

not pretty but i didnt have a lot of time

I'm high as fuck.

Another roll please.

Butts.

Rolling.

Rolling.

No offense, but you have a weird way of coding.
#include

#define SENTENCE "Green is my pepper, OP is a faggot"

int main(void)
{
char *str = SENTENCE;
printf("%s\n", str);

int words = 0;
while (*str)
{
if (*str == ' ' && *(str - 1) != ' ')
words++;
str++;
}
if (*str != ' ')
words++;

printf("Number of words: %d\n", words);
}

experimental rollan

What’s wierd about it? I’m new to C so that probably explains it-
Is initializing/iterating over the string like I did bad?

not that guy, but your loop calls strlen every iteration, his never calls it, since it keeps going until it hits \0

Again, no offense, but you rack disciprine. Just some styling issues. Also, your strings are a little funky. I wouldn't include a '\n' inside a string literal if I'm just using inside a printf call.

Actually, I fucked up.
This
if (*str != ' ')
words++;

should be this
if (*--str != ' ')
words++;

import matplotlib.pyplot as plt

n = 27

y_values = [n]
while y_values[-1] != 1:
if y_values[-1] % 2 == 0:
y_values.append(y_values[-1]/2)
else:
y_values.append((y_values[-1]*3)+1)
x_values = list(range(0, len(y_values)))

plt.title("Collatz Conjecture", fontsize=16)
plt.xlabel("# of Steps", fontsize=14)
plt.plot(x_values, y_values)
plt.savefig("collatz.png")

Attached: collatz.png (640x480, 34K)

That counts spaces but not words.

Best books for beginners to learn programming?

You could change the while loop to a do-while
do
{
if (*str == ' ' && *(str - 1) != ' ')
words++;
} while (*++str);

Rolling again.

you could also remove those braces

Word.

...

rolling

the hard part is starting out. once you have something you want to program you force yourself to do nothing else for a while, until your mind gets too addicted to that.
also rolling

What does the latter version do differently?

it counts whenever there is a space and the next character is not a space, which is exactly the case when there is a new word.
there are other problems with the code though. like using strlen in the for loop condition, or reading out of bound with the str[i+1].

The while loop terminates when the pointer hits the NULL in the string. So, when I check if the pointer isn't a space, it will always be true; because it's a null.

it doesn't read out of bounds in this instance, but you're right that its sketchy design

Also, his string literals are formatted weirdly.

He's learning, it's ok.

don't you mean ++str?

No, that would be out of bounds. After the while loop terminates, str points to a NULL char.

Thanks for the advice Jow Forums!

rollin'

can someone tell me how to get addicted to eating healthy and working out? kthx

Roll

Whats brainfuck?

Whats a search engine?

Is there a reason to use your own config file instead of a .json?

Attached: 1529530208139.jpg (638x638, 22K)

You mean format-wise?

Ignore all the retards here.
What you need to do is take your idea and hack something together. It doesn't matter how shitty, spaghetti-like or inefficient your code is. Just get it done.
Then, you look back at your code and make comments about what you think you could do to improve it or make it more efficient.
Go through the problems you listed one by one and google a solution or look in a book. But never copy/paste. Type it all out yourself. Once you've completed that, go through your code again and comment about how you can make it even better.
Repeat ad-infinitum until you are satisfied with your work. By this point you should be good enough at programming to enjoy it.

Yep, otherwise building a parser is needed.
Not really in the feels to do build one

roll
I need a simple project to learn rust

84 is pretty easy, you can use the OpenSSL crate

I actually don't know what "XOR" encryption means. I was just going to roll my own diffie-hellman since I at least know the equations

I'll take a look at the OpenSSL crate, though. Thanks.

You take a key and XOR whatever data with it. Pretty simple.

Is the key pre-agreed upon? Seems kind of useless (or maybe that's why it's "basic"?)

>smoke weed
???

Guys, how do I stop being addicted to programming? I honestly think I have a mental disease or something.

first time

>key pre-agreed upon
That's up to you. You can come up with an algorithm to handle that.

>Seems kind of useless
That's why it's not really used.

Buy Thinkpad
Install VS community 2017
Use Sublime

>Install VS community 2017
You're lazy.

>Sublime
Eww.

I just want to write C# without a big hassle. Probably going to switch to VS code soon

Why would you ever use C# instead of Java. Memes aside, so much easier to finds jobs and contracts for Java

The problem is that you're trying to think about what you know about programming and how you can make that into an idea. Instead what you want to do is come up with an idea then make it a program. The more you practice this the better you'll get.

>writing in java over a C based language

Java is based on C++ witch is based on C

Part of my job has me working with Stratis (blockchain Enterprise) which is C#. Also, I kinda dabble in Godot. And C# is comfy .net

Are we posting code?
This was pretty fun, rust is kind of comfy
pastebin.com/raw/m77Mbb1r