[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 43
File: prog.jpg (113 KB, 473x496) Image search: [Google]
prog.jpg
113 KB, 473x496
What are you working on, /g/?
Old: >>52476540
>>
Fixing Unix, check it out here
https://github.com/torvalds/linux
>>
Rewriting Gentoo in OCaml.
>>
File: NOT_ANIME.png (59 KB, 1232x804) Image search: [Google]
NOT_ANIME.png
59 KB, 1232x804
Reminder
>>
>>52481167
Yaoi's not a bad board, you should try it sometime.
>>
Pony-related vidya
>>
>>52481217
this
>>
haskell is a failure
>>
>>52481339
Just like your life
>>
File: oh-snap.jpg (187 KB, 375x500) Image search: [Google]
oh-snap.jpg
187 KB, 375x500
>>52481360
>>
what do you guys do when you aren't bent over a computer keyboard?
>>
>>52481449
not an awful lot
>>
>>52481449
sleep
piss
shit
>>
File: fuck off newfag.png (343 KB, 1760x1760) Image search: [Google]
fuck off newfag.png
343 KB, 1760x1760
>>52481167
Fuck off back to where you came from
>>
/* Text scroller. Designed for 80x24 terminals that support color. */

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

// x, starts at 4
int x = 4;

int main()
{
// DO NOT REMOVE!
// disable buffers so that we can have immediate printing
setbuf(stdout, NULL);

// loop variable
int l;

// main text box loop occurs here
// TEMPORARY: change the # in the for statement
// to change how many times it scrolls.
for (l = 0; l < 100; l++)
{
loopblock();
// set delay; this will work since we disabled buffers!
usleep(200 * 1000);
}
return(0);
}
int loopblock()
{
printf("\r%*s", x, "Hell");
x++;
}

I got the text scrolling now I need help actually wrapping it around one single line in the terminal

It just goes off the screen border in a glitchy kind of way right now
>>
>>52481449

I spent 80% of my waking hours in front of a screen. When I am walking between classes, or sitting on the bus, I have my phone out. When I am at home, I am typically on my laptop.

I am rarely "bent over" a keyboard, however. I like to do a lot of my computing laying down in my bed. Programming while horizontal is good shit.
>>
>>52481534
it prints "Hell" over and over again?
>>
>>52481572
It scrolls the text "Hell"

yes
>>
>>52481534

1. Use code tags next time.
2. Use ncurses, if possible. Your code is not portable to Windows, but with ncurses, it could be. It would also run on OS/2.
>>
Do you guys watch porn with your sister?
>>
>>52481652
>ncurses
I puked a little.
>>
>>52481667
I did with my cousin once
>>
>>52481667
No, I either watch porn of my sister or I make porn with my sister.
>>
>>52481501
Most anti-anime fags are hating anime just for replies and to piss you off. The only way to get rid of them is to pretend they don't exist.
>>
>>52481449
Watching animu
>>
who wants to team up and make a game
>>
>>52481449
watching anime, playing retro vidya (I bought ocarina of time for my N64 this morning), and 4chan.
>>
What are some tips for staying up and not feel sleepy?
I'm extremely tired right now and going to bed would probably like heaven, but I need some shit done and I can't go to sleep yet.
>>
>>52481734
I'll make the logo
>>
>>52481734
i'll think of the title
>>
>>52481734
let's make a game about animu girls that fight for free software.
>>
How do I make my code more masculine, /dpt/?
>>
>>52481769
Write it in ocaml.
>>
>>52481652
Do you actually believe he should convert what appears to be babby's second C program to use ncurses?
>>
>>52481769
Write procedural code. The computer is your bitch. You must command it to obey you. Procedural code is the only way. OOP and FP are feminism embodied.
>>
>>52481734
What kind of game?
>>
>>52481815
rpg
>>
>>52481810
>you should do the job of the computer in its place like a bitch
>that's manly!
>unlike commanding the computer and letting it do all the work
>that's womanly
t. cmen
>>
>>52481801

If he wants to start doing color text and other various non-standard terminal tricks, then yes. Besides, ncurses isn't that hard to use, and every C programmer has to learn how the hell to use a 3rd party library someday anyways.
>>
>>52481815
A roguelike but it's not a roguelike and also all other roguelikes are grinding games or sidescrollers and please donate to me i make best game in world please

Or so he said last thread.
>>
>>52481837
It's not that hard to use if you don't mind every other action crashing the program with a segfault and being forced to trial-and-error how to setup the parameters for functions because the documentation is dogshit.
>>
>>52481845
i never said that
>>
>>52481796
Like this:
#define _3(x) {
#define _8(x) }

#include <stdio.h>

int main()
_3(=====|)

puts("Hello world!");

_8(=====|)
>>
>>52481845
also what last thread?
>>
>>52481888
Damn, replied to the wrong post: >>52481769
>>
>>52481829
Oh sorry, I thought you were that anon from the previous thread and I was trying to bait. (See also: >>52481845)

I don't actually have time to join a team (got a large project of my own to work on right now), but what sort of RPG are you planning to make?
>>
>>52481764
>>52481829
>>52481845

sounds good i'm in
>>
Why can't I create, /g/?

I've never been able to make something original in my life. Whenever someone has asked me to make them a program that does X, I've always been able to do it, but the problem I have is I can't make my own goals. I always have to be given an idea by someone else.

I'm like this with everything, I can draw a picture if someone else comes up with a rough sketch for it, but I can't make the initial idea up on my own. I can write a paper if someone gives me a topic, but I can't make up my own topics. I can program anything I want, as long as someone else tells me what to program. No matter how much I try or want to, I can't come up with a single original idea on my own.

Am I broken? Does someone know how to fix it?
>>
>>52481915
lol kill yourself you just got counter-baited haha roflmao xd
>>
>>52481939
You're creative spirit has been destroyed by the public school system, same as everyone else.
>>
>>52481951
Yeah I realized about 30 seconds after I posted that I was probably a fucking dumbass. I took >>52481873 to be the same anon as >>52481829, confused about why people were assuming he was making a roguelike.
>>
File: 1435885287781.jpg (49 KB, 640x480) Image search: [Google]
1435885287781.jpg
49 KB, 640x480
>>52481939
>I have lots of ideas
>They would all be shitloads of work
>Can't be fucked with such a huge undertaking
>All of my ideas are worthless now
>>
>>52481939
Autism, seriously
>>
>>52481810
what's the difference between procedural and oop?

does it just mean you don't use functions?

sorry for being retarded, i'm just a silly girl.
>>
>>52481983
Post tits or gtfo
>>
>>52481963
>dmg+ctrl
>>
>>52481983
codrrr grrrrlllllllll

post tits and learn proper practices faggot
>>
>>52481939
Try LSD or shrooms.
Or just think of something in your life that you could make better with a certain program. Like, how can you improve your life right now?
>>
>>52481993
>>52482004
please answer my question, anons.

what's the difference between procedural and oop?
>>
>>52481999
>literally admit in my own post that i was a dumbass and completely misinterpreted what was going on in the thread
>"lol damage control"
???
>>
>>52481962
Not everybody, apparently, my girlfriend can create I have friends that can create, I just seem to lack the ability

>>52481978
How do you get them? Where do they come from? How can I get some for myself?

>>52481982
I'm not going to deny the possibility, but if I am it's really minor. Is complete lack of creativity a symptom?

>>52482010
>just think of something in your life that you could make better with a certain program.

I feel like this is a little bit different from the creativity I'm talking about. I've made programs for myself before, but what causes it is me thinking "fuck, I'm not going to do this all by hand" and I feel like that is different from real creativity.

>Try LSD or shrooms.
I've tried two tabs of LSD, but it must have been some weak shit, because I barely felt it
>>
>>52481999
Some people are actually capable of admitting they were wrong, you know.
>>
https://www.youtube.com/watch?v=LS37SNYjg8w
>>
>>52481167
But anon you've got LGBT, Pony, Random, and S4S listed in columns.
>>
>>52482054
both columns*
>>
>>52482054
>>52482065
Is that a complete intersection there? Why did you go through all of them to find that? Why don't you just ignore shitposts?
>>
>>52482090
Because muh autism.
>>
>>52482040
>How do you get them?
It's mostly stuff that I want. "I wish I had a program that does this" or "I want a program which uses this new technology".
>Where do they come from?
Most of my idea comes when I'm taking a shower. I'll usually spend ages in there, just thinking about shit.
>>
>>52482040
Real creativity is coming up with a unique solution to a problem. So if you've made programs for yourself that's already creativity.

Think of something that'll help other people or that they'll find useful. It doesn't have to be something huge like Facebook, but when you start getting ideas more ideas will come to you.
>>
Why aren't you using docopt, /dpt/?
http://docopt.org
>>
>>52482025
If your tits are good enough maybe I'll tell you, grill!
>>
>>52482189
Because Command is better and comes with the standard library.
>>
are there any app devs here looking for freelance work?
>>
>>52482201
456
>>
>>52482233
Me.
>>
File: CS wow.png (2 MB, 942x743) Image search: [Google]
CS wow.png
2 MB, 942x743
Can /g/ do /sci/'s hw?

>>>/sci/7788752
>>In C++
>1. Declare a 10 integer array called fluffy.
>2. Declare a pointer to the 3rd element in fluffy.
>3. Create a for loop that prints each odd number between 27 and 63.
>4. Declare a filestream object for reading a file "data.txt"
>
>Afterwards, professor asks who thought to themselves "What did I get myself into?", only people raising their hand are the 6-7 somewhat attractive girls in the class.

/sci/'s solution:
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <string>

int main(){
using std cout;
using std endl;
using std fstream;
using std string;

//1
int * fluffy= nullptr;
fluffy= (int*) realloc ((void*) fluffy, 10*sizeof(int));

//2
int * fluffy3 = fluffy;
for(int i=1; i<3; ++i)
++fluffy3;

//3
for(int j=0; j<100; ++j){
if(j>26 && j<64){
if(j&1)
cout<<j<<endl;
}
}

//4
string file("data.txt");
fstream obj(file.c_str());

return 0;
}
>>
>>52481810
>getting cucked by the compiler and assembler
>not writing in machine code
>>
>>52482258
are you
>>
>>52481535
Can you draw a diagram? I don't see how that'd be comfortable at all.
>>
>>52482197
Cringe.

You sound like a teenager overexcited to be potentially talking to a girl on the internet.
>>
>>52482270
top kek you're lying
>>
File: IMG_20151209_230220.jpg (35 KB, 469x527) Image search: [Google]
IMG_20151209_230220.jpg
35 KB, 469x527
>>52482270
Can't wake up
>>
File: carson jeb wake me up trump.jpg (199 KB, 1240x299) Image search: [Google]
carson jeb wake me up trump.jpg
199 KB, 1240x299
>>52482347
WAKE ME UP
>>
>>52482333
If you're not gonna post'em, get the fuck out bitch!
>>
>>52481449

6AM gym
9 - 5 work
6 - 8 study / build personal apps
8 - 10 prep for next day / chill with fiancee

I spend a lot of time in front of the computer to help prepare my future for my soon-to-be wife and me. We want kids and a crib in the country somewhere, so we're willing to bust our butts to get it.

>tfw video games aren't fun anymore
>tfw building apps that have little to do with games are the most fun

I have a couple ideas I'm fleshing out and I couldn't be more pleased. Venture capitalism is something I'm really interested in so we'll see where my builds can lead me.
>>
>>52481830
>implying procedural means low-level
Schools have been shilling for FP since the 70's so they don't teach much anymore. The quality of education suffers as a result.
>>
>>52482375
As evident by the likes of you.
>>
dubs test
>>
>>52482295
>getting cucked by actual code
>not writing in mix
>>
>>52482401
REEEEEE
>>
>>52482270
>>Afterwards, professor asks who thought to themselves "What did I get myself into?", only people raising their hand are the 6-7 somewhat attractive girls in the class.

I found that the further I get into the CS program, the women are less attractive, crazier, and fewer in number.

Too spooky.
>>
>>52482419
This 5
>>
File: 1452124326364.jpg (137 KB, 917x871) Image search: [Google]
1452124326364.jpg
137 KB, 917x871
Do you think men's brains are just better at thinking logically than 3D women's brains?
>>
>>52482270
Why not
int * fluffy3 = fluffy + 3;

>>52482424
That's just how this shit goes
>>
File: 1441439560294.jpg (80 KB, 500x500) Image search: [Google]
1441439560294.jpg
80 KB, 500x500
>>52482270
Retard reporting in.
#include <stdio.h>

int main(void)
{
// 1
int fluffy[10] = { 0 };

// 2
int *fluff3p = &fluffy[2];

// 3
unsigned int i;
for (i = 28; i < 63; ++i) {
if (i % 2 == 0)
continue;
else
printf("%d ", i);
}

// idk how to do 4
}
>>
>>52482447

Yes. Men have more idiots than women, but also more geniuses.

Women's standard deviation is closer to the mean.
>>
>>52482460
wrong. even the stupidest man is atleast as smart as the smartest woman
>>
>>52482475
Only if you limit the selection of men to the top 10% as most people do.
>>
>>52482475

Oh, you're right. My mistake. Damn, I feel like the smartest woman in the world right now.
>>
>>52482487
If you're so smart why haven't you posted your tits yet?
>>
>>52482318
Yes, that's correct.
>>
>>52482475
Don't be stupid, anon.

Men on average are smarter than women, but some men are more stupid than the average woman (see mirror).
>>
>>52481939
start with something unoriginal and make it original, think of ways you can make something better or more efficient.

Here are some ideas to get started:
https://github.com/karan/Projects
>>
>>52482501
post your email. i might have a job for you
>>
>>52482040
Why not pick a creative hobby, learn how to paint or learn how to play an instrument
>>
>>52482270
fucking retarded solution

even if you knew this little about programming you should be able to do better

>>52482424
>women suck at programming
this is new
>>
File: 1452190950134.jpg (30 KB, 272x350) Image search: [Google]
1452190950134.jpg
30 KB, 272x350
What's it called when people pretend to be retarded just to make a position they disagree with look bad?
>>
>>52482521
[email protected]

Contact me through there until I know you're not going to sign me up to a bunch of gay porn.
>>
>>52482562
Falseflagging.
>>
>>52482475
some men are really fucking dumb

almost all women are more or less average

the majority of men are average (still smarter than the average woman when it come to logical reasoning), some are really smart and some are really dumb
>>
File: animeface.png (3 KB, 800x600) Image search: [Google]
animeface.png
3 KB, 800x600
>>52482562
a strawman
>>
Anyone have any tips for making shit actually stick when I'm trying to learn it?

I've been reading through the online version of Automate the Boring Stuff with Python and while I'm working through a chapter I feel like I'm totally getting it, but then the second I move down to the questions and practice projects I draw total blanks outside of the incredibly basic stuff.

I've tried re-reading, taking notes even, and all that but it just doesn't seem to work.
>>
>>52482578
nice bait
>>
So, guys, I understand that a computer stores a floating point number basically as scientific notation in the form of binary using the formula m b^e.

But how is the decimal number calculated from the binary number you're left with? Is it some algorithm? Actually, I guess it would be the reverse of what you did to get to that in the first place, wouldn't it.

Where can I see this algorithm? Or is it some really low-level logic gate wizardry that I could never comprehend?
>>
File: Screenshot (20).png (528 KB, 1920x1080) Image search: [Google]
Screenshot (20).png
528 KB, 1920x1080
>>52482590
Not bait. It's my actual secondary email.
>>
>>52482270

That should absolute be the next /dpt image.
Fuck that loli shit.
>>
>>52482552

It's not that women are inherently bad at programming, it's that the women that are actually interested in programming are scary and crazy.
>>
>>52482589
you must actually write code
>>
>>52481939
it's all in your head
>>
What's the metric by which a programming language is deemed low or high level? Is it how closely it lets you interact with memory?
>>
>>52482270
Rate:
use std::fs::OpenOptions;

fn main() {
let fluffy: [i32; 10] = [0; 10];
let _ptr = &fluffy[2];

for n in (27..64).filter(|n| n % 2 != 0) {
println!("{}", n);
}

let _file = OpenOptions::new()
.read(true)
.write(true)
.create(true)
.open("data.txt");
}
>>
>>52482640
1/4, failed all but the first task.
>>
>>52482639
Kind of.
It's based off of how obfuscated it is from binary code. Machine language uses mnemonics which have a one-to-one relationship with binary so it's considered to be the lowest level code that is viable for programming.
>>
>>52482603
Go through the IEEE 754 spec for floating point numbers. It specifies the format for storing and retrieving the number. The algorithm is implemented in hardware to allow it to be encoded in constant time AFAIK.
>>
>>52482671
Meant to say assembly instead of machine language. Machine language IS binary, sorry.
>>
>>52482457
>if (i % 2 == 0)
> continue;
>>
File: dd.jpg (24 KB, 300x250) Image search: [Google]
dd.jpg
24 KB, 300x250
>tfw i got into an argument on reddit

hold me, /dpt/
>>
File: 1406803019377.jpg (103 KB, 1280x720) Image search: [Google]
1406803019377.jpg
103 KB, 1280x720
>>52482719
I think you should kill yourself
>>
>>52482639
Just general terms. It's to do with abstraction, and how close you are to what the computer's actually doing.

A list of programming languages ranging from very low to very high level:

Machine Code could be considered the lowest level programming language.

Assembly language is at the level of telling the processor what to do. There is still a conversion step towards machine code.

C is a step up from assembler, because you get to specify what you want to do in slightly more abstract terms, but you're still fairly close to the metal.

Java/C# do similar things to C++ in a way, but without the opportunity to do everything you can do in C (like pointer manipulation in Java's case [thanks Joe!]). They have garbage collection though, which you have to do manually in C++.

SQL is even higher level (it's declarative). Just say "Give me all the items in the table sorted by age" and it will work out the most efficient way to carry this out for you.
>>
>>52482719
post thread
>>
>>52482719
>>>/reddit/
Or kill yourself.
>>
>>52481667
If I had a sister and she asked, I think I would. I'm not much of a fan of lewd things, though. Lewd things with my sister, though? Of course I would make an exception.
>>
>>52482612
>2612â–¶
>>>52482589


This.

Make something.

You'll find books and documentation are absolutely essential to do this. Hopefully, what happens, is that you think about the problems you run into while designing and making your program, and recall the documentation and academic shit.
>>
Any bored hackers out there? I need your help please
>>
>>52482590
Do you want my help or not?
>>
>>52482746
shoot
>>
>>52482746
I hacked ur mum last nite lol
>>
File: dfg.jpg (104 KB, 1280x720) Image search: [Google]
dfg.jpg
104 KB, 1280x720
It triggers my autism that there isn't a known pattern with prime numbers.

Please find a way, /dpt/. I've tried everything.
>>
>>52482691
thank you!
>>
>>52482746
Me.
This is me>>52482604

Contact me on that email.
>>
File: m'hacker.jpg (48 KB, 469x463) Image search: [Google]
m'hacker.jpg
48 KB, 469x463
>>52482746
This is guy fawkes. What do you need, friend?
>>
>>52482767
But there is:
https://en.wikipedia.org/wiki/Ulam_spiral
>>
>>52482767
Here's the pattern: they all are only divisible by one and itself.
>>
>>52482774
So you can help me?
>>
>>52482746
Yeah, just input AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA into the program and hope something works
>>
*sighs* It's something stupid but, there's an iFunny username I want, since that person is very unactive I wanted someone to help me out
>>
>>52482792
Yes. Depending on how much you're willing to pay
>>
>>52482786
>>52482789
I mean, for example, I should be able to work out what the 4824th prime is on a calculator in less than 5 seconds.
>>
>>52482833
I'm in. Check your mailbox tomorrow for a letter from "Anon-sama".
>>
>>52482851
XD aww shit, I forgot about that
>>
>>52482405
>getting cucked by writing
>not buying a shitload of electronic logic gates and wiring them yourself
>>
>>52482833
I'm guessing you want money right? I don't know how to repay
>>
Alright, I'll be upfront about it
It's not actually an iFunny username I want, but a Furaffinity username >.>
>>
>>52482767
Just make an iterator that returns numbers divisible by itself and 1. Access that number by referencing the index that it's at.
>>
>>52482861
Wha?! How XD
To be honest I'm just a newfag
>>
>>52482889
Hey! XD not a furry
>>
>>52482907
I launched a MS-DOS attack on furaffinity's mainframe. I got the user and pass. Send a bitcoin to the wallet I'll email you tomorrow to your live account and I'll send them.
>>
>>52482449
>using unnamed constants
>>
If I make a kik chat, will you join in to help me out?
>>
>>52482851
but anon, its already instantaneous:
Prelude> import Data.Numbers.Primes
Prelude Data.Numbers.Primes> primes !! 4824
46687
>>
>>52482640
What functional language is this so that I know not to actively avoid it?

The syntax is OK.
>>
File: ih.png (337 KB, 554x720) Image search: [Google]
ih.png
337 KB, 554x720
>>52482901
I know how to generate primes, anon.

I just think it would be neat if there were a way to tell if a number is prime without checking if it is divisible by previous numbers.
>>
>>52482956
that loops OOP to me
>>
>>52482971
Maybe you could figure it out if you weren't a disgrace to your parent's genetic make-up and had your brain rot by Japanese cartoons for infants.
>>
So no one will help me out? ._.
>>
>>52482978
Apparently it's Rust. How terrible. Oh well.

What got me though is that it reminded me of C#.
Like, a lot.
>>
>>52482955
>Prelude> import Data.Numbers.Primes

><no location info>:
> Could not find module ‘Data.Numbers.Primes’
> It is not a module in the current program, or in any known package.
>>
>>52483043
cabal install primes
>>
File: Screenshot_2016-01-17-21-23-28.png (319 KB, 1440x2560) Image search: [Google]
Screenshot_2016-01-17-21-23-28.png
319 KB, 1440x2560
>>52482971
Maybe you could make use of this
>>
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47...


What's the pattern, /dpt/?

How do I work out the billionth number in this pattern?
>>
>>52483093
>false positives are possible
Into the bin it goes.
>>
>>52482270
int* realloc void*

bruh
>>
>>52483104
odd numbers
the answer is 500,000,001
>>
>>52483104
the numbers are the zeros to the function
y = (x - 2) * (x - 3) * (x - 5) * (x - 7) * (x - 11) * (x - 13) * (x - 17) * (x - 19) * (x - 23) * (x - 29) * (x - 31) * (x - 37) * (x - 41) * (x - 43) * (x - 47)
There are no other numbers in the series.
>>
>>52482712
What's the problem senpai?
>>
>>52483119
If you're trying to find the billionth number of the pattern then generate prime numbers until i.length = 1 billion.
If you're testing to see if the number is prime or not then do what the picture tells you. You're almost never going to get a false positive.
>>
>>52483104
EZ just prove the Riemann hypothesis
>>
>>52483154
Where's 15 anon? What's 2 doing there?
>>
>>52482270
It's amazing how bad this is.
>>
>>52483104
they're primes you dip
>>
>>52483244
And why isn't there a pattern?
>>
>>52483260
Holy fuck
>>
File: Ulam_1.png (12 KB, 400x400) Image search: [Google]
Ulam_1.png
12 KB, 400x400
>>52482786
Yaw 'avin' me on incha?
>>
Does anyone know what the software used to analyze .exe file is called? I remember using it a while back, but I forget the name. It starts with an "O".
>>
>>52483272
Does that mean, "I don't know"?
>>
hayy lmao

int cunt,fu=0;
cin >> cunt;
cout << "\nDivisible by: \n";
for(int i=2; i<cunt; i++){
if(cunt%i == 0){
fu=1;
cout << i << endl;
}
}
cout <<'\n';
if(fu==1){
cout<<"number is not prime\n";
} else {
cout<<"number is prime\n";
}
return 0;
>>
>>52482786
Just looks like random dots tbqh.
>>
>>52483314
Of course I don't know. It's one of the open questions in mathematics for fucks sake. Go on mathoverflow anon
>>
$ cat o.nim 
proc test(n): auto =
if n == 0:
return 0
else:
return 1
echo test(9)
$ nim c o.nim
Hint: system [Processing]
Hint: o [Processing]
o.nim(1, 11) Warning: '(n): auto' has no type. Typeless parameters are deprecated; only allowed for 'template' [TypelessParam]
CC: o
Hint: [Link]
Hint: operation successful (9859 lines compiled; 0.131 sec total; 14.148MB; Debug Build) [SuccessX]
$ ./o
1
$ cat s.nim
proc test(n): auto =
if n == 0:
return 0
else:
return "fuck"
echo test(9)
$ nim c s.nim
Hint: system [Processing]
Hint: s [Processing]
s.nim(1, 11) Warning: '(n): auto' has no type. Typeless parameters are deprecated; only allowed for 'template' [TypelessParam]
s.nim(6, 10) template/generic instantiation from here
s.nim(5, 12) Error: type mismatch: got (string) but expected 'int literal(0)'
$

what is this
Can I not mix return types?
>>52483296
OllyDBG? Ida?
>>
File: 1432474561840.jpg (150 KB, 450x640) Image search: [Google]
1432474561840.jpg
150 KB, 450x640
Hello, im wanna get into programming.What are some beginner languages you could recommend?
pic unrelated
>>
File: nj.png (1 MB, 700x992) Image search: [Google]
nj.png
1 MB, 700x992
>>52483345
No need to be so upset, anon.
>>
>>52483363
http://www.htdp.org/2003-09-26/Book/
>>
>>52483363
C++, C, and assembly

fuck all the other babby languages. Learn from the best first.
>>
>>52483387
ok ill give it a read.
>>
>>52483363
Learn C
get a good book with a lot of examples
type out all of the examples yourself or you won't learn anything
>>
>>52483396
>C++
>best
>>
File: 1450681384030.gif (549 KB, 720x534) Image search: [Google]
1450681384030.gif
549 KB, 720x534
>>52483382
I'm not upset, just suprised someone one doesn't know there's no known pattern for primes.

I AM upset your animu isn't a smug loli. Fix this
>>
>>52483363
Hello, friend. I will recommend you a language based on a personality test:

>Why do you want to get into programing?
>Do you have autism?
>Any projects in mind?
>Windows or Unix?
>cheeky or verbose?
>Do you do drugs?
>>
File: 1432860473789.png (40 KB, 335x342) Image search: [Google]
1432860473789.png
40 KB, 335x342
>>52483396
>C++
>>
File: altf4_keyboard.jpg (67 KB, 403x142) Image search: [Google]
altf4_keyboard.jpg
67 KB, 403x142
>>52483419
>>
>>52483396
Fuck this kid, do NOT learn C++ first, or your whole experience will be figuring out its indecipherable bullshit rather than learning how your code actually works
leave learning C++ to when you absolutely have to (if you're planning on programming for a career you will have to)
>>
>>52483490
>indecipherable

want to recommend a language that is more "decipherable"?
>>
File: 1452446496816.png (616 KB, 895x892) Image search: [Google]
1452446496816.png
616 KB, 895x892
>>52483430
I think smug anime girls are rude.

I don't like to be rude.

And I know there isn't a known pattern, I even said so in my first post: >>52482767
>>
>>52483514
bythn :DDDDd
>>
>>52483514
C is the obvious one

it doesn't have some of the features C++ has, obviously, but you almost certainly won't need those features until you have to learn C++ anyway
>>
>>52481088
jesus, almost gave me a boner there
>>
>>52483559
So... C is more decipherable than C++... even though C++ is backwards compatible ...
>>
File: 1451611925138.jpg (226 KB, 600x960) Image search: [Google]
1451611925138.jpg
226 KB, 600x960
>>52483520
My lolis can bully your lolis
>>
File: fZQOg8v.gif (2 MB, 400x595) Image search: [Google]
fZQOg8v.gif
2 MB, 400x595
>>52483592
How about now
>>
>>52483599
>C++ is backwards compatible
Not completely
>>
>>52483599
Yes

What are you trying to say with all those ellipses you're throwing around?
>>
File: wq.png (188 KB, 500x476) Image search: [Google]
wq.png
188 KB, 500x476
>>52483602
Your lolis are brown and therefore have more testosterone.

Bullying isn't a nice trait for lolis to have anyways, my lolis are superior because they never bully.
>>
>>52481939
People don't usually code just for the hell of it. It's a solution to a problem. If you don't have any "problems" you won't need to write anything. Just think about something that could be done easier, quicker, more efficiently with code. Draw up a plan or specific set of requirements if you have problems keeping it in your head, then implement. Maybe a change of languages will motivate you. I noticed I wanted to write more when I started implementing things in python instead of C or bash. I've written a script to go from a command line Debian install to a full desktop, a script that updates maps based on deltas to save bandwidth and time, and currently working on a programmable rpn calculator. Those are just some of the things I've written out of my own necessity. At some point you will find something you want and do it.
>>
>>52483609
>3D
I mean, sure, it would beat masturbation, but I'd still be thinking of 2D girls.
>>
>>52482727
Late versions of c++ have garbage collection that you can use. Not exactly the same way as Java, but it's something.
>>
>>52483631
Trying to be condescending I guess, but seriously I agree. Learning it in the order of C then C++ makes a lot of sense.
>>
File: 1449201110198.png (217 KB, 531x705) Image search: [Google]
1449201110198.png
217 KB, 531x705
>>52483705
Only the superior can bully anon. Only inferior lolis get bullied. It's a doggy dog world anon
>>
>>52483823
*dog eat dog
>>
>>52483431
ok
>because I like computers and want to learn more
>not that i know of
>not yet i just wanna learn it as a hobby
>w-windows
>verbose I guess
>no
>>
>>52483741
Not him, but I would really like a program that read a book for me and distilled the essentials of it. Kids are too fucking wordy with their writing these days,
>>
>>52483599
>C++ is backwards compatible
int array[n];
>>
>>52483839
People like you are a diamond dozen. You just can't tako or leaf it, it's always Busy Ness when you're round.
>>
File: 1452322895006.png (70 KB, 300x468) Image search: [Google]
1452322895006.png
70 KB, 300x468
>>52483826
>>52483874
You deleted your post because you forgot ">" at the beginning of your quote?

Kek.
>>
>>52483909
Meme arrows are important
>>
File: 1404852528863.png (1001 KB, 2000x3112) Image search: [Google]
1404852528863.png
1001 KB, 2000x3112
Hey /dpt/.

This is not exactly a programming question, but I would appreciate you guys' input on this.

I am working on an assignment for a CS course, and the professor provided the following line of pseudocode as part of a larger algorithm:

for i = 1 to n print("x");


My question is this:
When the line says "1 to n", would you interpret it as "1 to n INCLUSIVE" or "1 to n EXCLUSIVE"?
For example, if n were to be 2, would the output be "x" or "xx"?

I would ask the professor on this, but it is Sunday and I have no friends in the class to ask either.

What do you guys think?
>>
>>52483878
I am sorry to be the baron of bad news, but you seem buttered, so allow me to play doubles advocate here for a moment. For all intensive purposes I think you are wrong. In an age where false morals are a diamond dozen, true virtues are a blessing in the skies, and are more than just ice king on the cake. We often put our false morality on a petal stool like a bunch of pre-Madonnas, but you all seem to be taking something very valuable for granite.

So I ask of you to mustard up all the strength you can because it is a doggy dog world out there. Although there is some merit to what you are saying it seems like you have a huge ship on your shoulder. In your argument you seem to throw everything in but the kids Nsync, and even though you are having a feel day with this I am here to bring you back into reality.

I have a sick sense when it comes to these types of things. It is almost spooky, because I cannot turn a blonde eye to these glaring flaws in your rhetoric. I have zero taller ants when it comes to people spouting out hate in the name of moral righteousness. You just need to remember what comes around is all around, and when supply and command fails you will be the first to go.

Make my words, when you get down to brass stacks it doesn't take rocket appliances to get two birds stoned at once. It's clear who makes the pants in this relationship, and sometimes you just have to swallow your prize and accept the fax, instead of making a half-harded effort. You might have to come to this conclusion through denial and error but I swear on my mother's mating name that when you put the petal to the medal you will pass with flying carpets like it's a peach of cake.
>>
>>52483944
Try the algorithm with both?
>>
>>52483944
To go from 1 to 2 requires 1 step, therefore I would say "x"
>>
>>52483957
>everything in but the kids Nsync
> rocket appliances
my sides
>>
>>52483841
>C# - because you are on windows
C# is a a great language that is amazing on windows (but less portable than m$ would like to you to think). It's high level, so you wont be learning as much about how computers really work. C# has loads of libraries that can figure out dates, search through text, etc. In essence, it babies you more than C.
>C - because you wanted to learn about computers
C is "close to the metal" in that you're literally ordering the CPU to allocate memory and operate on it. You'll learn about how the computer really works. As a language it is simple, which is great. The toolkit is very small as well - all you need is a compiler and a text editor. C will perform much better than C#, but you'll miss out on all of the cool libs of C#.
>>
>>52483944
most likely inclusive, but email your prof because /dpt/ cant read his mind. be sure to include an anime avatar image so he knows its you.
>>
File: image.png (66 KB, 1323x664) Image search: [Google]
image.png
66 KB, 1323x664
>>52483999
The assignment isn't about running the algorithm, sorry for not being clear.

I have to make an equation that evaluates to the number of times that "x" is printed out for any given value of n, and prove that this is the case.

Whether or not that line is supposed to be inclusive or exclusive would have an impact on the final result, and I'm not sure which one to go with.

Pic related, it's the problem
>>
>>52484061
>be sure to include an anime avatar image so he knows its you
good idea thanks
>>
>>52484069
1 to n usually implies [1,n]. Starting at zero implies [0, n).
>>
File: 1449878616110.jpg (408 KB, 1024x720) Image search: [Google]
1449878616110.jpg
408 KB, 1024x720
>>52484061
>>52483944
I got you senpai
>>
is anyone having a problem where 4chan threads load extremely slowly?

>open gif from local storage
>gif doesn't play
>close gif
>gjewgle chrome totally chimps out
>spend hours saving incognito shit (didn't want to use session buddy because i knew i wouldn't open it again but i resorted to it for the last 2 windows)
>restart google chrome
>all other websites load fine but 4chan threads still load extremely slowly like a batch of posts at a time instead of everything at once
>>
>>52484093
Well, that's news to me

Thanks for the clarification, I'll go with inclusive for the assignment but still email the prof before its due
>>
HEY MOOTWO

GIVE US /PROG/ BACK
>>
>>52484122
It was slow as shit, anon.
>>
>>52484033
ok I will thank you
>>
>>52483233
What's wrong with it? It works doesn't it
>>
>>52484171
It was faster than /po/
>>
>>52483957
>baron of bad news
>>
https://www.youtube.com/watch?v=Zi0RpNSELas

We are the world, /dpt/
>>
Trying some cross platform networking in C. Is Winsock as bad as the rest of the Windows API? Should I use Cygwin instead?
>>
>>52484265
>cross platform
>Windows API

what
>>
>>52484104
seems like it's something with javascript because i disabled it and now 4chan loads fine too

but it's extremely uncomfortable to post with javascript off so what the fuck can i do
>>
>>52484314
I'm obviously using POSIX sockets for other platforms, I just don't know if I should write Windows-specific code or not.
>>
>>52484069
It's not exactly difficult to answer it both ways and then just turn in the right one when you ask him later.

Hell, the phrasing is going to be the same either way, just memorize the numbers for both answers, and fill in the blanks on the spot when you ask him
>>
File: 1425271680909.gif (848 KB, 665x662) Image search: [Google]
1425271680909.gif
848 KB, 665x662
>>52484332
scratch that

FUCK GOOGLE DEVS
>>
>>52484265
>>52484354
The basics are kind of the same, socket/connect/bind/listen/accept just need to initialize a struct (WSAStartup)and use SOCKET type instead of int.

You also don't have unix goodies like select() on the descriptor.
>>
>>52482833
it's quite difficult to do i'd have to consult an expert

what are your credentials?
>>
>>52484069
isn't the amount of "x" outputted given by
xs (n) = n * log2 n
>>
>>52484471
Good to know, thanks.
>>
>>52481702

When it gets off topic its annoying though
>>
>>52484539
I only count 3.
Thread replies: 255
Thread images: 43

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.