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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 313
Thread images: 57

File: best_book.jpg (103KB, 483x632px) Image search: [Google]
best_book.jpg
103KB, 483x632px
ActionScript edition
What are you working on, /g/?
Old thread: >>60283641
>>
File: 1491750904126.jpg (66KB, 1280x720px) Image search: [Google]
1491750904126.jpg
66KB, 1280x720px
Employed calculus of constructions programmer reporting in.
>>
function ackermann(m:uint, n:uint):uint
{
if (m == 0)
{
return n + 1;
}
if (n == 0)
{
return ackermann(m - 1, 1);
}

return ackermann(m - 1, ackermann(m, n - 1));
}
>>
>>60289330
>Design Patterns
ActionScript = ActionShit
>>
File: 1447381619784.jpg (178KB, 900x900px) Image search: [Google]
1447381619784.jpg
178KB, 900x900px
>>60289472
shutup actionscript was a great babbys first programming language because flash was more easily deployable than almost every runtime out there when it came out
>>
I believe in the last thread somebody said Haskell was faster than Java. Are you fucking retarded?
>>
File: dlang_chan.jpg (139KB, 470x545px) Image search: [Google]
dlang_chan.jpg
139KB, 470x545px
Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); and she's super duper cute and easy to prototype in! Say something nice about her, /dpt/!
>>
>>60289355

Just because you are employed and a programmer does not mean you are employed AS a programmer.
>>
File: G7zfm7z.png (2MB, 1080x1080px) Image search: [Google]
G7zfm7z.png
2MB, 1080x1080px
>>60289494
Haskell is faster than C
>>
File: abstraction.png (292KB, 678x394px) Image search: [Google]
abstraction.png
292KB, 678x394px
>>
VS Code™ is pretty nice lads.
What does /g/ think of it?
>>
>>60289534
I am though.
>>
>>60289625
it's got some decent plugins and it runs better than that piece of shit atom so it has that going for it. already dropped visual studio a while back in favor of qt creator for C++, but i often use vs code for C#, shaders, JSON, XML, plaintext, etc. might make a DSL soon and i'd consider doing a plugin for highlighting/completion if the API looks alright
>>
playfilly speaking

unemployed dna programmer. post code snippets as tribute and I will imburse. can share intribute to those willing to act as playment for time. The last few were garbage and I have no keyboard atm.
>>
>>60289776
>it runs better than that piece of shit atom
I've got to wonder why that is. Does Atom just get commits from tranny "programmers"?
>>
>>60289786
not so playfully speaking


anyone have a clue how i can make code sheets quick and well enough just using my shitty smart phone?
>>
File: 1489503850789.jpg (41KB, 394x353px) Image search: [Google]
1489503850789.jpg
41KB, 394x353px
Write a C program which adds two integers using 5-star pointers.
>>
>>60289539
Not faster, just about the same. As long as you're in the decidable subset.
>>
File: 1494310966129.png (16KB, 463x130px) Image search: [Google]
1494310966129.png
16KB, 463x130px
https://pastebin.com/3Fw42jJL
https://github.com/qbittorrent/qBittorrent/wiki/How-to-write-a-search-plugin
What am I doing wrong?
>>
>>60289790
are you high?

>>60289797
at first i assumed it must have been because atom runs on a node.js backend, but then i saw that vs code actually runs on the same framework. so yeah, i don't know, maybe it's just shit contributors
>>
What the coolest/most complex program you have ever made?
>>
>>60289922
FizzBuzz
>>
>>60289933
haha! xD
>>
>>60289922
your drink
>>
>>60289625
VS Code is awesome when developing in Angular 2. It has Typescript highlighting and that is nice. Also SASS and other stuff.
Like the other guys say. It's a good editor and pretty lightweight.
Oh and by the way. Fuck Atom.
>>
>>60290013
you sound your diction like a loud indian kid
>>
>>60289966
please comment and subscribe it helps a lot
>>
File: 1482483073223.png (14KB, 166x166px) Image search: [Google]
1482483073223.png
14KB, 166x166px
>>60289856
Rust programmer here, did i do it right?

https://ideone.com/c5LvNY
>>
File: 1490945149612.jpg (40KB, 500x500px) Image search: [Google]
1490945149612.jpg
40KB, 500x500px
>get contractor to do comms protocol stack
>application layer needs to set bit7 of a byte to make acknowledgement message
outputbyte = inputbyte == message1 ? message1ack :
inputbyte == message2 ? message2ack :
inputbyte == message3 ? message3ack :
inputbyte == message4 ? message4ack :
inputbyte == message5 ? message5ack :
inputbyte;
>>
>>60290031
Looks who's talking
>>
>>60290013
>and pretty lightweight.
>>
>>60289539
>>60289875

What are you guys smoking?

>https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ghc&lang2=gcc
>>
>>60290121
Are you a disagreeing fag?
>>
File: 1482594403805.png (101KB, 960x1053px) Image search: [Google]
1482594403805.png
101KB, 960x1053px
>>60289330
Seeing the last thread, i started on a O(1)-indexable string in Rust
>>
>>60290115
marcu
>>
>>60290141
>Vector
Shiggy diggy
>>
>>60290141
I'm building servo right now. Why is it that they say it's usable *now* but when I try it's a giant shitshow? I've been waiting ages for it to get more stable so I can make my own browser
>>
File: 1486317346571.png (325KB, 382x417px) Image search: [Google]
1486317346571.png
325KB, 382x417px
>>60290167
What's wrong with Vector?
>>
>>60290172
It's usable in the sense you can build it and render websites somewhat okay. What you want is feature parity with other engines, i.e. websites rendered with servo look the same as other engines. That's still far off.
>>
>>60290202
>What you want is feature parity with other engines
I actually just want it to not take a giant dump and not crash.
>>
>>60290223
File a bug?
>>
>Rust won first place for "most loved programming language" in the Stack Overflow Developer Survey in 2016 and 2017.
Someone get me off this ride. PLEASE
>>
>>60290042

https://ideone.com/O3k1i3

You don't really need to use malloc...
>>
>>60290273
>a meaningless award
Shillzilla can buy all the shit they want, it wont stop rust from being a fad.
>>
Can you recommend me some imageboard or similar chat open source for linux? I would like to host that and practice.
>>
I scored a job at a trendy startup. I need an avatar icon that will make people think I am cool.

Help, please
>>
>>60289904
nvm figured it out
>>
>>60290566
I heard Pepe was the in thing
>>
>>60290572
Good on you, anon!

>>60290583
dumb implicit frogposter
>>
>>60290583

thats the thing i thought about instantly, but the people here probably browse IT news sites or reddit and think its a nazi symbol
>>
>>60290592
Time to redpill your co-workers.
Stay woke anon.
>>
File: 1425170108784.jpg (12KB, 222x227px) Image search: [Google]
1425170108784.jpg
12KB, 222x227px
>>60290566
Just use the universally accepted symbol of shitposting.
>>
I did some comparing of C++ and Java , more precisely the amount of memory that these two languages use up when running the same operation. The operation was the filling of 8 000 000 array with a value of 777. After tracking the memory that both languages used in this program, Java managed to use up more than five times more than C++. All the values were written to heap memory.
What might be the factors that contribute to such high memory usage in Java?
>>
>>60290676
Java is garbage
>>
Is Fortran deprecated? I'm final year in civil engineering department at college but nevertheless research room's teacher gave a crash course about it and I liked its simplicity.
>>
>>60290708
physicists still use it for number crunching
>>
>>60290657

it is an IT company
meaning it is packed to the brim with pajeets
meaning its not a good idea to post alt-right memes
>>
Is this what C fags consider good code? Got this snippet from my professor.
#define STRLEN 81

int equals(char x[STRLEN], char y[STRLEN])
{
unsigned i = 0;
while(x[i] == y[i])
if(!x[++i]) return true;
return false;
}
>>
>>60290836

what's wrong with that?
>>
any ideas on how to solve/display a recaptcha in a terminal application? can i display it with framebuffers on console? what would a nice way in xorg?
>>
>>60290836
>Professor
No
>>
>>60290836
No, why is it a sized array parameter if the size isn't used in the body? Just pass char* x and char* y like God intended.
>>
>>60290836
>int equals
>return false

disgusting
>>
>>60289509
Nice tumor.
>>
>>60289509
Seek help for your condition.
>>
>>60290995
Yes, actually.
>>
>>60291222
Answer >>60290853
>>
>>60291270
ur such an ebic trole xDD
>>
File: Made.png (69KB, 1157x768px) Image search: [Google]
Made.png
69KB, 1157x768px
I made this!

It's a super simple WPF application that just takes the text fields, appends them to a string builder, and then writes the text to a file with the date as a filename.

You can select a directory to write to within the current directory using a combobox and you can create directories in the current directories with a text field and a button.
>>
>>60291285
Answer >>60290853.
>>
>>60291313
Good job anon, that's actually pretty neat
>>
>>60291340
Thanks, I'll post my games too if I have anything cool to show.
>>
How do you guys deal with 3rd party libraries using a different code style, so for example they use camel case and you use snake case?
Do you write wrappers just for this?
Ignore it?
>>
>>60291599
Depends.
If they're a one-time usage kindof thing, i'll suck it up. If i have to use it regularly i write wrappers
>>
File: kuc2.jpg (76KB, 1132x698px) Image search: [Google]
kuc2.jpg
76KB, 1132x698px
How do I find an open source project to contribute to?

Want to get some python and C contributions on my CV
>>
What case are you supposed to use for C?

Camel? Snek?
>>
>>60291699
snake_case you shitter

>>60291681
Gnu has many projects written in C that might need new maintainer or just developers in general.
>>
>>60291699
I personally use dicKCase
>>
>>60291753
>too late to invent Facebook
>too early to make millions mining asteroids
>just in time to witness the dawn of the dicKCase era
>>
i need to do a web application for my final proyect, it uses a certain technology so it must be in java. where should i start? i've looked into Spring Boot but it seems weird and bloated, maybe there are better alternatives
>>
>>60291722

I tried this a while back.

Noone new to C wants to get stuck trying to offer bugfixes to a clusterfuck like most of GNU's 30 year old legacy code.

It's actually disappointing, exciting projects are well managed by people who don't need much help, and exceedingly unexciting projects just suck.
>>
File: syntax.webm (289KB, 828x1020px) Image search: [Google]
syntax.webm
289KB, 828x1020px
why cant neovim recognise the ft
halp pls
>>
Just starting f#. Any idea why this just returns a list of the same digits?

let x = 10
let y = 10

let generateRandomness =
let rnd = System.Random()
List.init x (fun _ -> (rnd.Next(0, 2)))


let Maze = [for i in 1..y -> generateRandomness]


returns
val Maze : int list list =
[[0; 1; 0; 0; 1; 1; 0; 0; 1; 1]; [0; 1; 0; 0; 1; 1; 0; 0; 1; 1];
[0; 1; 0; 0; 1; 1; 0; 0; 1; 1]; [0; 1; 0; 0; 1; 1; 0; 0; 1; 1];
[0; 1; 0; 0; 1; 1; 0; 0; 1; 1]; [0; 1; 0; 0; 1; 1; 0; 0; 1; 1];
[0; 1; 0; 0; 1; 1; 0; 0; 1; 1]; [0; 1; 0; 0; 1; 1; 0; 0; 1; 1];
[0; 1; 0; 0; 1; 1; 0; 0; 1; 1]; [0; 1; 0; 0; 1; 1; 0; 0; 1; 1]]


I'd want the list to have unique variables.
>>
>>60291993
Because you're creating a new Random on every loop.

Declare your Random outside of the loop, and use the same Random to call
rnd.Next()
.
>>
File: anal beads.png (22KB, 1785x443px) Image search: [Google]
anal beads.png
22KB, 1785x443px
>>60291993
>>60292031

Pic related shows the behavior you're wanting, followed by what you're currently doing.

This is due to the fact that Random is seeded based on the current DateTime ticks, so creating 100 new Random objects nearly instantly all at once is going to produce the same initial random number.

var x = 10;
var y = 10;

var rnd = new Random();

List<int> generateRandomness() => Range(0, x).Select(i => rnd.Next(0, 2)).ToList();

var Maze = Range(0, y).Select(i => generateRandomness());
>>
>>60292110
>>60292031

Cheers chaps

Still struggling with it as moving rand outside the loop didn't work, just need to convert the other solution into f#.
>>
File: anal beads.png (21KB, 1851x323px) Image search: [Google]
anal beads.png
21KB, 1851x323px
>>60292243
>moving rand outside the loop didn't work
Probably for the same reason this doesn't work (returns the same list over and over):
var x = 10;
var y = 10;

var rnd = new Random();

var generateRandomness = Range(0, x).Select(i => rnd.Next(0, 2)).ToList();

var Maze = Range(0, y).Select(i => generateRandomness);


But this does (returns a new random list on each iteration):
var x = 10;
var y = 10;

var rnd = new Random();

var generateRandomness = Range(0, x).Select(i => rnd.Next(0, 2));

var Maze = Range(0, y).Select(i => generateRandomness);


The distinction here is whether you're realizing your list of random numbers before you begin to call upon it.

I'm assuming that
List.init
is similar to C#'s
.ToList()
.

In the former, you're creating a list of random numbers, rather than a query on how to get 10 random numbers, because I'm calling
.ToList()
, doing the work, and getting that information in memory.

In the latter, I'm creating a LINQ enumerable that "knows how to retrieve 10 random numbers", so if I call upon this ten times, it's going to do the actual work to retrieve 10 random numbers 10 times.
>>
What stimulant do you use dpt?
caffeine mints masterrace here
>>
>>60291989
elp pls ;-;
>>
basic bash script


how do you pass an argument with double quotes in a var that you want to execute with
echo ` ... $var`
?
>>
>>60291903
pls help, how do i web app in java?
>>
Doing a C assignment for some kid for 200 turkish liras involving POSIX semaphores, threads and shm. He's paying me to have fun pretty much
>>
>>60292404
>bumping your post 45 minutes later when it's early in the morning here in the civilized world
>talking about java and immediately jumps to the nonsensical "weird and bloated" complaint because it's too hard for your curry-infested brain to grasp
>not using the last 45 minutes of your life to do a modicum of research and easily see all of the modern Java web frameworks and at least picking one and doing an initial demo

You're not going to make it.
>>
File: autistic screeching.png (399KB, 3555x2198px) Image search: [Google]
autistic screeching.png
399KB, 3555x2198px
>>60292412
They have STEM in roachland?
>>
>>60292440
yeah, we do the real work and leave the webdev and stuff to you cuz we know that's what you can do xd
>>
>>60290141
what is this meme language, learn java and get a job neet fag
>>
>>60292454
Hatching cockroach eggs is not real work
>>
>>60292327

Cheers man, I appreciate the help.

Looks like I might be taking the wrong approach then based on what you're saying.

Rather than grabbing that list every time, I may as well have nested for-loops within Maze that would generate it so it would be different everytime.
>>
>>60292480
eh, im okay with roach memes, knowing it's US that's the lolcow of the world
>>
>>60292497
>Erdogan
>Not the ultimate lolcow
>>
>>60292412
>for 200 turkish liras
Did they finally fix their inflated currency or are you working for free?
>>
>>60292412
200 turkish liras have been deposited to your account, Emre.
>>
>>60289330
>What are you working on, /g/?
I'm working on finding a job. Turns out every fucking company in this shithole of Bumfuckistan needs Java and JavaScript programmers or web developers. Where have the decent jobs gone? REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
>>
>>60292577
The YTL (Yeni, or new) chopped off six zeros a long while ago.

>>60292589
Teşekkürler :^)
>>
>>60292589
kek
>>60292577
it's getting better
>>60292576
everytime Erdogan embarrasses himself he has Trump to take the center stage for him as a clown, he's ok
>>
File: anal beads.png (23KB, 203x1801px) Image search: [Google]
anal beads.png
23KB, 203x1801px
>>60292486
Something equivalent to this would be sufficient:

var rnd = new Random();
var width = 10;
var height = 10;
var Maze = Range(0, height).Select(i => Range(0, width).Select(j => rnd.Next(0, 2)));


Although, it doesn't look particularly "maze-y" to me.
>>
>>60292620


My plan is just to generate a maze, implement A* algorithm or whatever, if theres a solution to the maze, I.E. gets from top left to bottom right then I'll print it, if not then it will just keep generating them until it does find a working one.

Pretty fucking terrible I know but I'm bored of fsharp already.
>>
File: 1483386852061.png (134KB, 960x1053px) Image search: [Google]
1483386852061.png
134KB, 960x1053px
>>60292471
No u
>>
What does '|' mean in Big O Notation?

E.g. for some graph where vertices are V: O(|V|).

Does it mean floor?
>>
>>60292729
Absolute value
>>
>>60292729
>>60292735
|S| is notation meaning the number of elements in set S. (It also means absolute value if you're talking about numbers instead of sets. Maths is fun like that).

So, in your case it means the number of vertices.
>>
>>60292760
>>60292735
Cool beans, thanks dudes
>>
>>60292760
Though in big-o I haven't seen it written like that. Normally you'd just call that O(n).
>>
>>60290042
>malloc
Yeah he's a rusty alright. How is the CoC up your ass?
>>
>>60292809
Pretty comfy
>>
File: 1493421169087.jpg (109KB, 1200x1198px) Image search: [Google]
1493421169087.jpg
109KB, 1200x1198px
>>60292330
my only stimulant is writing clean, safe & optimized code.
>>
>>60292675
>Borrow, BorrowMut
>Deref, DerefMut
>Index, IndexMut
Sure is Rust here.
>>
>>60291903
I think play framework can be used with java. Only used it with scala, so i don't know how well it works, though.
>>
>>60292675
nice boilerplate
>>
did you know that this existed?

https://freesoftwarefoundation.org/prog/
>>
>>60292675
Lo and behold glory of rust. Boilerplate on par with java but for name of safety. Productive and succint language for champions! Hail rust!
>>
>>60289330
Is a 3 semester "programming trainee career certificate" from a Community College enough to get an entry level gig?

>https://www.tcc.edu/academics/information-technology/programs/programming-career-certificate
>>
File: 1468502394582.jpg (68KB, 800x526px) Image search: [Google]
1468502394582.jpg
68KB, 800x526px
>>60293329
>Not even an Associates
No

>be proficient in Java and Script
>>
>>60293367
You can keep taking classes and get an associates, I only see jobs that require bachelors though...
>>
>>60292675
What I never understood is why &mut T is a type which makes 0 sense to me.

let a: i32 = 16;
let a1: i32 = 16;
let mut b: i32 = 16;
let mut b1: i32 = 16;
let c: &i32 = &a;
let d: &mut i32 = &mut b;
let mut e: &i32 = &a1;
let mut f: &mut i32 = &mut b1;
this whole syntax just looks so fucking retarded.

Also fuck those retarded keywords Rust uses like: let, fn, mod, str and vec.
>>
>>60293254
>ctrl+f "jew"
>2 matches
>ctrl+f "lisp"
>9 matches
>>
>>60293444
>Also fuck those retarded keywords Rust uses like: let, fn, mod, str and vec.
The founding father of Rust thought it was a good idea to cap keywords at max 5 characters. That dumb fuck nigger.
>>
File: 1370025076063.jpg (27KB, 336x342px) Image search: [Google]
1370025076063.jpg
27KB, 336x342px
>>60293254
>>
>>60293600
I can live with func instead of function, but seriously:
function = func > fn
module > mod
string > str
vector > vec
Implement > impl
public > pub

The one who thought let was a good keyword should forever burn in hell.
>>
>>60293329
>be proficient in Java and Script

what the actual fuck
>>
in python you have to import a copy package to say x = y and change an attribute of x without it changing the attribute of y
>>
What is the best book for data structure?
In my country all interviewers almost always ask problems related to data structure.It looks like there isn't a standard for data structure.
For instance, linked list in CLRS has 3 mandatory operations. INSERT, DELETE, and SEARCH and that too with a particular prototype like INSERT add only to head and not any specific position. I got a question where insert was of prototype INSERT(node,atpos). I wasted time implementing this and ran out of time. I wish I read a book where data structure are thoroughly presented.
>>
>>60293803
What's wrong with the let keyword? It's the only sane one desu.
>>
>>60293329
it's enough to get an IT job somewhere, where you need basic programming skills sometimes. you're not going to be working at google but if you know that's what you want go for it anon
>>
>>60293860
it's only a for loop couting positions
>>
>>60293883
Thanks for the encouragement anon. I already have a bunch of Networking certs, they do t hold the same value as they used to.
>>
>>60293877
I don't really see what's sane about it,
let thing = 2; "let thing is 2" it sounds retarded.
>>
>>60293939
equal, anon. let x equal 2.
>>
Was forced to learn Java for my first two programming courses. I want to learn a non-OOP programming language now. What do you guys recommend? Also, what OOP course will give me the best job outlooks in America? C++?
>>
>>60294034
C++
>>
Does anyone have that programming-challenge picture that lets you roll for different projects?
>>
>>60293939
If you pronounce it like >>60294002 said, I don't see any problem with it.
>>
>>60294053

>C++ is not OOP
It's multiparadigm for sure, but still.
>>
File: omrskw.png (52KB, 449x174px) Image search: [Google]
omrskw.png
52KB, 449x174px
holy shit /dpt/ BTFO!!!!!!!!!!!!!!!!
>>
Write an O(n)-time nonrecursive procedure that, given an n-node binary tree, prints out the key of each node. Use no more than constant extra space outside of the tree itself and do not modify the tree, even temporarily, during the procedure.
>>
>>60294235
anime is magical
>>
>>60293803
>>60293939
why do you care? lol
>>
>>60294034
F# for static OCaml with .NET on top
Clojure for dynamic Lisp with JVM or Javascript on top
Elm for castrated (but easier) Haskell for browsers
>>
>>60294243

I'm retarded but this sounds too easy
void dump(Tree tree)
{
if (tree == null)
return;
dump(tree.left);
println(tree.key);
dump(tree.right);
}
>>
If I want to communicate between two haskell programs over the network, what would be the best library to use? I basically just need one to be a server and accept multiple clients then they pass data between each other.
>>
>>60294361
>non-recursive
>>
>>60294406

That's the retarded bit. Hmm.
I guess it would be cheating if each node had a reference to the parent.
>>
>>60294392
kys.hs
>>
i have a typescript/javascript question but it's not really related to web dev at all

i have this class that's shared between multiple contexts (instances of it are passed between same-origin windows/frames that do different things and have different capabilities)

what should i do about methods that are only relevant in one context, and shouldn't ever be used in the less privileged ones?

how can i put the methods somewhere else without making it too inconvenient to use them?
>>
>>60290178
It's inefficient.
>>
>>60294477
fr*cking epic dude
>>
why do people shit on only C for buffer overflow problems when C++ has the same problems?
>>
File: 1470306362512.jpg (42KB, 712x712px) Image search: [Google]
1470306362512.jpg
42KB, 712x712px
>>60289330
Trying to average two integers in the C programming language. Is it possible?
>>
>>60294879
should've used rust
>>
>>60294533
Web "dev" questions belong in >>>/g/wdg/
>>
>>60294879

int a = 3;
int b = 4;
int c = (3 + 4) / 2; // 3
double d = (3 + 4) / 2.0; // 3.5


>>60294876

because c++ gives you tools to help prevent buffer overflows e.g. std::string
>>
>>60294876
C at least somewhat resembles a programming language, while sepples isn't one at all. Why would sepples be discussed in this thread?
>>
>>60294876
Because it provides you with facilities to prevent those to some degree. Technically you could just use some well tested library for data structures and strings in C as well but the language doesn't offer as many features to deal with some of the relevant stuff properly and C programmers are too prideful to use something tested so they'd rather roll something on their own since they're know-it-alls and definitely won't make any mistake ever.
>>
>>60294926
but the question isn't about to the hip new framework of the week and has more to do with programming in general than web dev

just pretend i mentioned rust instead of javascript if it'd satisfy you that way
>>
i made a typo
>>
>>60289365
Generalize to the hyperoperation sequence proper.
>>
>>60294992
No, it's web "dev" trash and anyone can see that without even reading the first sentence.
I assume this isn't voluntary so I'm genuinely sorry for you, but please ask in the subhuman thread. There's no need to fill this place with any more filth than absolutely necessary.
>>
>>60294876
Code monkeys syndrome. Don't worry about them.
>>
Reading up on learncpp.com and everything is easy and programming is a breeze
But now it's about pointers and jesus fuck I'm lost
Can anyone give some simple real-world examples of pointer usage?
The syntax confuses me and I'm having a hard time wrapping my mind around the syntax and the use cases. Also English isn't my first language (I'm a Finn, not a Pajeet) so sometimes the terminology makes me uneasy too. What does "dereferencing" mean? Is there a synonym for the word?
>>
>>60295176
Learn C before C++ Anon. You'll thank me later.
>>
>>60294876
because C "programmers" are arrogant fucking morons
>>
File: Untitled.jpg (104KB, 819x855px) Image search: [Google]
Untitled.jpg
104KB, 819x855px
>>60290566
>>
>>60295176
>real-world
What is a "real world'? Is there a fake one?
>dereferencing
Think of it as removing one layer of reference.
>>
>>60295338
>What is a "real world'? Is there a fake one?
I mean example code without foos and bars

>Think of it as removing one layer of reference.
that makes some sense
>>
>>60295176
>>60295206

This, if you're struggling with pointers you want to go right back to basics. C++ will only confuse you.

Dynamic memory and arrays are the biggest uses of pointers.
Dereferencing means "going to where the pointer points".
>>
>>60295176
see >>60295206
also ignore the "before" part. it's best to ignore sepples altogether.
>>60295354
so if I take an example code and perform some renaming such that every variable is called foo-x where x is unique with each appearance of foo- then that will still work?
>>
>>60289534
Just because you are a girl and employed does not mean you are employed AS a girl.
>>
File: 1485129506235.png (41KB, 315x259px) Image search: [Google]
1485129506235.png
41KB, 315x259px
>>60294950
Thank you. I have also heard you can add so-called "pointers". How would one go about doing that?
>>
I'm working on my stupid social music startup. You can check it out here: https://www.juicebox.dj/

Today, I want to:
- create signups dashboard
- move settings to user profiles
>>
>>60295397
Not programming, fuck off, retard.
>>>/g/wdg/
>>
>>60295407
I saw this thread first you narrow-minded fuck.
>>
>>60290742
That's not an alt right meme, it's an anime girl.
>>
>>60295397
Will to be similar to Plug.DJ? I think it looks pretty good.

>>60295431
You gotta learn to ignore shitposters, anon.
>>
I hate each and every one of you in this thread you delusional idealist mathmagicians stop liking programming programming is awful and is NOT fun at all in and of itself why don't you make something useful instead of implementing obscure math proofs in esoteric languages and arguing about which way of doing literally the exact same thing is better

>>60295397
except you. stop stealing my ideas tho :< [spoiler]are you hiring?[/spoiler]

someone end my suffering
>>
>>60295476
this post appears to be in English but I don't understand what it's trying to say. are you on the spectrum by any chance?
>>
>>60295471
Hey thanks. And yeah it's basically plug.dj without the dumb avatars. The music's also on autoplay so you don't have to manage the queue all the time. Feel free to make an account!
>>
>>60295395

    int somenumbers[] = {2, 4, 6, 8};
int *ptr_to_first_number = somenumbers;
printf("%d", *ptr_to_first_number); // 2
int *ptr_to_third_number = ptr_to_first_number + 2;
printf("%d", *ptr_to_third_number); // 6
>>
File: good_shet.png (90KB, 572x505px) Image search: [Google]
good_shet.png
90KB, 572x505px
>>60289330
>What are you working on, /g/?
just trying to learn regular expressions
they look pretty handy for shortening code but i haven't really wrapped my head around how they work just yet
>>
>>60295176
i don't really know what you mean by "real world example" either, given that we're talking about a more abstract part of C++/C, but...

say you have two array types(like std string and System String), whose types are incompatible, but they contain compatible information. if there is currently no comparison operator or copy operator between the two objects, you can copy one from the other "manually" by using references and pointers.
>>
>>60295515
Sweet, created.
Can you possibly add a volume adjustment though? The audio from youtube sometimes is too loud, but I don't want to mute it completely.
>>
Is there an API for detecting illegal content such as CP?
>>
>>60295650

https://en.wikipedia.org/wiki/PhotoDNA

Go find out.
>>
>>60295624
>You don't even know what programming is.
You already know anything that isn't C or Haskell isn't "programming" here.
>>
>>60295176
a bigger use probably lies in void pointers. it's complicated to describe, but any type can be converted to or from a void pointer. this allows you to do some stuff.

for example, let's say you know two data are formatted identically down to the binary level(that's 0s and 1s), but for some reason whoever programmed the library working with didn't provide an = operator. it's probably not good programming practice, but if necessary, to copy one type to the other you could convert *typea>*void>*typeb.

>>60295588 this is pretty much just repeating what i'm saying here, though. simply stated, a more legitimate use of void pointers is seen often in some approaches to dynamic typing.
>>
>>60291042
Not that guy.

So would this be an improvement on the code?
int equals(const char* x, const char* y){
unsigned int i = 0;
while(x[i] == y[i]){
if(!x[i]) return 1;
i++;
}
return 0;
}
>>
What are some codebase red flags?
>comments after every statement
>more comments than source code
>extremely verbose variable names
>stupid _i or f_ naming scheme to differentiate types
>iterators with names longer than 1 character
>if (i == 0)
>if (pointer == NULL)
>if (b == true) { return true; } else if (b == false) { return false; }
>>
I've seen a screenshot once by a C# anon on visual studio who unwrapped the results of his lists at compile time in a GUI tree and shit

Is that available for C++ ?
>>
>>60295752
>>extremely verbose variable names
this is probably personal preference but i prefer readable names over needlessly shortened ones
of course there's limits though, something like 3 words or 20 characters and you should probably consider renaming it
most editors have autocomplete these days
>>
Anyone HLSL here?

Can someone explain to me why HLSL comparison operators break down for numbers smaller than .5 between shaders?

For example, you have a shader on a model. It returns a float4 color value. Then you have a post effect which reads the result of this effect and does some calculation. I've found that in the post effect, when reading the result of the model shader operators like == will work reliably down until about(nearly exactly, really) .5. It could just be me but 1(not even that, .5) doesn't really seem like an acceptable number of significant digits in a float.

Should I just assume the implementation of HLSL in this program is shit or is there some general property of HLSL I'm unaware of at work here?
>>
>>60295752
>iterators with names longer than 1 character
For complex nested loops I use names, because fuck doing
for(int i)
->for(int j)
--for(int k)
array[i][j] = shit[k]

Yeah fuck you.
>>
>>60295835
>which reads the result of the model shader and does some calculation
Fixed for clarity.
And before it's suggested(hopefully) I'm aware there's often a need to use custom equality checks for floats, but it's just curious because it works fine above exactly .5, after which I need to compare manually, and under certain points it just starts doing things like returning true for .0021(explicitly stated return value) > .003.
>>
>>60295835
it's not HLSL, it's how floating point numbers work
Don't use the == operator to check float equality
>>
>>60295835
also you may be outputting to a frame buffer with low precision (the default is 8bits per color channel) which will give you some pretty inaccurate floats
>>
So what are you guys actually programming/working on?
>>
>>60296112
Rewriting major parts of Linux in my own programming language.
>>
>>60295856
>needing to maintain loop state manually
Lol?
>>
>>60296125
That sounds like a daunting task
>>
File: YOULIE.png (47KB, 1920x897px) Image search: [Google]
YOULIE.png
47KB, 1920x897px
>>60295946
Yeah, see >>60295906
I do that too, but sometmes the result is just outright unreliable.

See pictured.

>>60296056
That's what I'm thinking. It seems likely the default is probably not high enough, but I've worked under the assumption that it'd be better than half a digit of precision at least. I'm not sure where I would confirm that information, though, just in the sampler/texture declaration inside the post shader file?
>>
>>60296127
>game dev
Wrong thread.
Ask on >>>/vg/
>>
>>60296112
Making a compiler. Turns out it's fun as fuck.
>>
File: Callback function.png (82KB, 1210x708px) Image search: [Google]
Callback function.png
82KB, 1210x708px
>>60295176
I'm still trying to wrap my head around pointers myself: it gets hairier when you start using pointers on functions (pic related).
So, at the risk of being the blind leading the blind...

In short, the idea of pointers is that, instead of getting an object or value itself, you get the address of it.
The upsides of this are: it means you're not doubling up space by making another copy of the object; you can mess about with the object directly; it can be pretty efficient, resource-wise.
The downsides are: they're a pain to wrap your head around; they're a pain to use.

The code to use them looks like:
    int *ptr;            //Stores a pointer to an integer
ptr = &ref; //The &ref gives the address of ref (referencing?)
// ptr then stores the address
cout << *ptr << endl; //When not declaring a pointer, *ptr gives the integer (dereferencing?)


There is also pointer arithmetic which means, using the analogy of house addresses, that saying "ptr + 1", "ptr++" or ptr[1] is like saying "the next house along".

Hopefully I haven't flubbed something
>>
>>60296145
Oh, right, and I was also curious why exactly it works OVER .5, then suddenly breaks down. If it was just float calculation imprecision, by intuition I would expect that it would occur at the actual boundary between sig digits(as in .09 vs .1), so I would curious if anyone knew why it might be behaving that way in particular.
>>
>>60296211
>by intuition I would expect that it would occur at the actual boundary between sig digits(as in .09 vs .1)
that's not how floating points work, I don't know exactly how they're rounded but it's not linear or by significant digits
but it doesn't matter how they work, just use an equiv function instead of ==

but judging by your problem its an input/output problem, you need to check the precision of your buffer and weather it's being normalized or not. If you're doing deferred rendering your should use 32 bit color channels instead of the standard 8 bit
>>
rate my fizzbuzz in my language based on the reverse polish notation

def fizzBuzz
dup 0 = @return if

dup 3 % !
"Fizz" "" ifelse
print

dup 5 % !
"Buzz" "" ifelse
print

dup println
1 - fizzBuzz
end

100 fizzBuzz
>>
>>60296293
Ok, thanks for the advice. That really helps. I'll probably look into that and study floating point arithmetic more.
>>
>>60296361
reminder to report rule-breaking posts
>>
>>60295471
you wanna know stuff about plug.dj? I help them. Didn't think anybody outside of eastern europe even knew what it was.
>>
>>60296372
>study floating point arithmetic more.
you're going down the wrong path here, you do not need to understand how floats work in order to use them, all you need to understand is the more bits you're using, the more precision you'll have
>>
>>60296198
ah, right, that's the most important thing. it's hard to know as a novice programmer, but sometimes functions/objects/etc. will copy data entirely, regardless of what you "think" they are doing. pointers and references provide a way to explicitly state how you want the memory to be used.

tl;dr you're probably not thinking about it, but the system by default will do a lot of data copying when it could be using existing data, and you can avoid this with pointers.

also, in direct response to
>>60296198
that seems pretty much right, but i don't think he was asking for an explanation on pointers specifically. but since you gave one, i'd add that a pointer isn't just the address of an object. that's the idea of a reference. a pointer contains other information as well, such as type and size(i believe--not sure if that's just something the compiler does or if it's actually stored that way in memory under compiled operation). that's why you're able to do pointer arithmetic, because when you say "ptr + 1" the system knows to increment by the size of the pointer's type.
>>
File: 1491219003076.jpg (117KB, 1280x720px) Image search: [Google]
1491219003076.jpg
117KB, 1280x720px
>>60296318
-100 points for "def" and "end".
-18 points for "ifelse".
55 points for RPN.
120 points for writing a compliant Fizz Buzz.
>>
>>60295176
I say ignore everything replied to you and read some learning materials specifically about pointers.
I don't see how anyone could learn what pointers are from what's being said here.
>>
File: 1363816465111.jpg (39KB, 1118x514px) Image search: [Google]
1363816465111.jpg
39KB, 1118x514px
>>60296441
What should I use instead of def-end? I kinda lack imagitation. Also ifelse looks really ugly, but it has to be different from if and from elif (since the order is inverse)

what a qt anime girl
>>
File: 1491762690407.gif (2MB, 540x501px) Image search: [Google]
1491762690407.gif
2MB, 540x501px
>>60296516
>I kinda lack imagitation
stop being so kawaii
>>
File: cirno.png (48KB, 372x343px) Image search: [Google]
cirno.png
48KB, 372x343px
>>60296525
that wasnt intentional
have a smug cirno
>>
>>60296516
Maybe "proc" since it's a procedure? I don't really know, but "def" sounds like it belongs in some inferior language without RPN.
>Also ifelse looks really ugly, but it has to be different from if and from elif (since the order is inverse)
That might be a valid reason to keep it for now then.
>>
>>60295397
Have fun getting sued by YouTube and SoundCloud.
>>
>>60296551
I know it was unintentional that is why it was cute AF. bless you
>>
File: programming challenges.png (1MB, 3840x2160px) Image search: [Google]
programming challenges.png
1MB, 3840x2160px
Is there a certain project I can do to test if I have a decent overall knowledge of a language before moving on to another language, or should I do just a bunch of these?
>>
>>60296600
Create a programming language.
>>
>>60295397
the layout seems nice, the page loads slow but im guess thats just because its running on something slim until you have reason to bulk it up. nicer than some of the other streaming communities out there in terms of aesthetic. what are you using for your backend?

bit of advice: dont post your project here and expect any reasonable feedback. there are only a handful of us here that aren't autistic high-schoolers or kids in their CS undergrad.
>>
>>60296643
>bit of advice: dont post your project here and expect any reasonable feedback. there are only a handful of us here that aren't autistic high-schoolers or kids in their CS undergrad.
I feel deeply offended by this post as an autistic shitposting wagecuck.
>>
File: 1486674219908.png (71KB, 266x252px) Image search: [Google]
1486674219908.png
71KB, 266x252px
hey /dpt/ I'm gonna run to taco bell for lunch. Does anybody need me to pick them up anything?
>>
>>60296669
dont take it the wrong way m8. Im a consultant. doin' what you do too.
>>
>>60296683
grab me beer will ya
>>
File: ddx.png (6KB, 583x417px) Image search: [Google]
ddx.png
6KB, 583x417px
>>60296392
That's true. Knowing more about them couldn't hurt, though.

I also had another question, would you happen to know why the results of the builtin ddx and ddy functions are so grainy? Is there a way to get smoother results? Pictured is just the simple ddx of the x position, but although I've tried a lot of different things and functions(like taking the power of variables or smoothstepping it, which should give a non-linear result), for some reason the result is never really something I could do shading with. I believe I understand what it's computing(I'm not unfamiliar with derivatives) but I'm not sure how this is usable.
>>
>>60296683
three doritos locos, no lettuce, beefy nacho burrito, six cinnamon delights and a medium mountain dew

thanks
>>
File: 1454434569288.jpg (145KB, 591x559px) Image search: [Google]
1454434569288.jpg
145KB, 591x559px
What C/C++ IDE do you guys recommend?
>>
>>60296704
for sure, you a lager or IPA guy? i might have to stop at the gas station for it
>>
>>60296714
is Baja blast ok? they are out of regular MD
>>
>>60296718
Windows: MSVC (its bloat but has a good debugger)
Linux: QtCreator
>>
>>60296774
>MSVC
Which version?
>>
>>60296735
eh, I'll just drink water. health, you know?
>>
>>60296706
I dont know, I use openGL not directX
>>
>>60296718
Emacs and or Vim.
>>
>>60296718
GNU Emacs
>>
>>60296799
idk, 2015 is nice, haven't used msvc before then
>>
>>60296718
VS Code or Codeblocks
>>
>>60296837
>VS code
>IDE
Really anon?
>>
I want to make a hex editor with data visualization.
Any advise as to how I go about doing this? language, libraries, etc?
>>
>>60296841
How is it not an IDE?
Plus regardless it has everything youd want in an IDE.
>>
File: tacobell.jpg (156KB, 800x552px) Image search: [Google]
tacobell.jpg
156KB, 800x552px
>>60296726
changed my mind, I want a Baja blast too. with rum ty
>>
File: 1454601905045.jpg (78KB, 583x583px) Image search: [Google]
1454601905045.jpg
78KB, 583x583px
>>60289330
>int is just bits in disguise
>char is just an int in disguise
>string is just a char array in disguise
>>
File: ddxr32f.png (11KB, 483x439px) Image search: [Google]
ddxr32f.png
11KB, 483x439px
>>60296816
I hate being an idiot.

I had a feeling I'd be answering my own question when I started typing that(since I was thinking in the back of my mind that messy derivative detection could be a result of bad float precision), but I just tried using a 32 bit format like you suggested and immediately got this result.

This is just a test so it looks simple but I think it pretty much opens up a new world for me... I'd been meaning to try alternative texture formats for awhile but had been putting it off because I have other things to study/test too and I didn't have much confidence. Again, thanks for responding
>>
>>60294392
just use network.
If you're serving http then use servant and warp.
>>
>>60296951
>computers operate on physical state that can be abstracted to 1s and 0s
What a shocking revelation.
>>
>qfusion game engine
>written mostly in C
>supports linux, windows, macos and android
>should be good engine for making bindings to
>Literally no documentation on how to use the engine
FUCK
>>
>>60296567
Yeah proc sounds good. I guess I'll stick with ifelse for now, until I come up with something better. Have some fibonacci

proc fibonacci
dup 50 > @return if ; calculate until 50
dup ; duplicate prev
@+ swap ; add '+' and swap it with prev
dip ; 1 2 + 2 -> 3 2
swap
dup println
fibonacci
end

1 println 1 println
1 1 fibonacci
>>
>>60297045
Would this help?
https://github.com/Qfusion/qfusion/wiki
>>
>>60296957
>>60296816
Also I should probably confirm that you were right, the format switch fixed the inaccuracy problem I was having and now comparison generally works even at 10^-9 and such. Hard to believe I've gone over a year like this, I guess that's the power of dumb.
>>
>>60297126
Not really, the wiki is small and doesn't tell anything useful.
Also the engine seems to be basically warsow game, so using it as general engine would likely require messing with internals.
>>
>>60297045
Why not go normie mode and use Unity?
>>
>>60297221
but muh open sores!
>>
>>60297234
Well, Unity's fork of Mono is open source at least.
>>
>>60297221
Not him but these engines aren't made for programmers. There made for people who do art and scripting.
Getting something done in an idtech engine is easier for programmers.

Dunno why anon here would prefer an idtech derivative over the real deal. Qfusion has an up to date renderer maybe.
>>
File: 1492618231265.png (248KB, 1000x1200px) Image search: [Google]
1492618231265.png
248KB, 1000x1200px
>>60296718
Emacs. Ran approves it.
>>
>>60296951
>images are just int arrays in disguise
>movies are just image arrays in disguise
>>
File: 1444231914843.png (1MB, 1281x1080px) Image search: [Google]
1444231914843.png
1MB, 1281x1080px
Is this a good first attempt at Fizzbuzz in C?
https://ideone.com/jmXmWZ
>>
>>60297282
programmers make their own engines
once you've made the engine all you need to do is art and script
>>
>>60297367
1/10 because I reply
>>
>>60297370
>script
Simple games perhaps. Games with higher aspirations than being clones of one another require programming.
>>
>>60297162
you're welcome
>>
>>60297367
Not really, you should buy yourself some programming socks to improve
>>
>>60297367
Why did you hand unroll the loops?
>>
>>60297367
Compile it with -O2 and post the Disassembly.
>>
>>60297392
W-why?
>>60297406
What can I improve?
>>60297409
The loop syntax was confusing to me so I did it manually.
>>
>>60297456
>fizzBuzzInt = 1; fizzbuzz(fizzBuzzInt);
>not just doing fizzbuzz(1);
>>
>>60297367
No.
Why didn't you use a loop?
Either a for or a while loop would've gotten the job done with ~200 lines less of code.
And why did you include error messages and return 1 if you weren't going to check the return values and exit the program with it?
And why only up to 100?
>>
>>60297367
>>
>>60297045
either use a popular, tested, well-documented engine or make your own. taking the middle route by using some obscure engine nobody else uses carries the disadvantages of both
>>
File: 1459903454869.jpg (77KB, 854x576px) Image search: [Google]
1459903454869.jpg
77KB, 854x576px
>>60297471
Now I feel stupid for not realizing this immediately.

>>60297492
>Why didn't you use a loop?
The syntax is confusing.
>why did you include error messages and return 1 if you weren't going to check the return values and exit the program with it?
What's the alternative? Isn't it better to have some error checking?
>why only up to 100?
The original Fizzbuzz description only goes up to 100 though?
>>
File: IMG_20170509_121612.jpg (2MB, 5312x2988px) Image search: [Google]
IMG_20170509_121612.jpg
2MB, 5312x2988px
>>60296714
Shit I forgot the burrito
>>
>>60297573
if you were getting tested on fizzbuzz they would fail you because you don't know how to use a for loop
>>
File: 1409172119196.jpg (114KB, 1920x1116px) Image search: [Google]
1409172119196.jpg
114KB, 1920x1116px
Trying to implement an equivalent to Flash's BitmapData.perlinNoise() function but I have nothing to go off. I tried checking out shumway src to see if they had it implemented but they don't.
>>
>>60297573

for syntax might be a little confusing if this is your first time programming. Does this make any sense?
int fizzBuzzInt = 1;
while (fizzBuzzInt < 100)
{
fizzBuzz(fizzBuzzInt);
fizzBuzzInt = fizzBuzzInt + 1;
}
>>
>>60297649
>nothing to go off
What? Just search perlin noise or simplex noise.
>>
File: 1341619539905.jpg (107KB, 613x533px) Image search: [Google]
1341619539905.jpg
107KB, 613x533px
>>60297573
>The syntax is confusing
>>
>>60297649
https://en.wikipedia.org/wiki/Perlin_noise#Algorithm_detail
>>
File: 1477922731908.jpg (21KB, 599x334px) Image search: [Google]
1477922731908.jpg
21KB, 599x334px
>>60297573
don't cry akarin!
>>
>>60297692
>>60297721
Well that isn't the problem - Flash's version of it does all this extra shit that I am unable to replicate. Hence why I tried looking at shumway for a 1:1 port.
>>
>>60297737
Example?
>>
>>60297573
Dumb akariposter
>>
 warning: implicit declaration of function ‘_mm256_cos_pd’ [-Wimplicit-function-declaration]


I'm using gcc 5.4.0. I included immintrin.h and I can find it /usr/lib/gcc/
what's the deal?
>>
File: 1485760679630.gif (2MB, 297x226px) Image search: [Google]
1485760679630.gif
2MB, 297x226px
>got a demo to create
>stuck on /v/ arguing about games instead of making them like Im suppose to

30 and I still have trouble getting myself into the mood of programming. Some days, it just clicks, and suddenly I wrote like five thousand lines of codes. Then others, I'm just sitting there waiting for the light to click on. May be all the distractions. But the distractions are fun.
>>
File: lads.jpg (51KB, 694x416px) Image search: [Google]
lads.jpg
51KB, 694x416px
made a O(n) singly LL reversal algorithm with constant space

for some reason i was stuck on using a stack and the solution came to me when i was almost done in the gym on my last couple sets of deadlifts
>>
>>60297874
How? I'm interested?
>>
>>60297889
traverse the list, save the previously iterated link and just switch them around
>>
File: orin_baka.png (583KB, 1171x513px) Image search: [Google]
orin_baka.png
583KB, 1171x513px
>>60297573
>The syntax is confusing.
>>
>>60297889
you need to keep track of 3 nodes as you traverse. make middle point to back, set back to middle, middle to forward, and forward to forward.next
>>
File: 1473727760877.jpg (13KB, 236x306px) Image search: [Google]
1473727760877.jpg
13KB, 236x306px
hey guys, just got back from taco bell sorry that took so long i got caught on the phone.

>>60296886
here is that stuff you ordered

>>60296704
got you some beers meng
>>
>>60297941
Could you share some code?
>>
New thread:

>>60297987
>>60297987
>>60297987
>>
>>60297574
its cool man I'll just defrost one of those frozen dealios
...did you actually go to taco bell?
>>
>>60297924
That doesn't look like constant space.
>>
>>60298012
you dont save it in a stack, its just one extra local variable to account for the fact you dont have a previous link
>>
>>60298054
I want to see code.
>>
>>60298119
i already posted it in the (shit) new thread
>>
>>60298140
>>60298125?
>>
>>60297861
this is me too and I wish I knew how to deal with it.
>>
File: mnvi6hgrofwy.jpg (77KB, 605x807px) Image search: [Google]
mnvi6hgrofwy.jpg
77KB, 605x807px
why then i multiply int 1078 with double 0.05 on C# i get 53.900000000000006
Where and why does that 00...06 come from?
How do i fix? Tried converting int to double, and multiplying double 1078 with double 0.05 but that didnt help
>>
>>60298170
thats how floating point numbers work, you can't 'fix' it you just have tiny inaccuracies
>>
>>60298155
yeah.
>>
File: 1428859718392.jpg (178KB, 500x667px) Image search: [Google]
1428859718392.jpg
178KB, 500x667px
>>60297573
>The syntax is confusing
Fella, I don't even know what syntax means.
A "for loop", in C at least, works like this:
for( [initialiser goes here]; [condition to be met goes here]; [increment goes here])
{
[stuff to be repeated goes here]
}


What's usual is something like:
int i;
for(i = 0; i<100; i = i+1){
doSomething(i);
}

It's possible to leave any and all parts empty. E.G: for( ; ; ) would repeat forever.

A "while loop" is like a "for loop" without initialiser or increment parts:
while([condition to be met goes here])
{
[stuff to be repeated goes here]
}


You can make a "while loop" act like a "for loop" by writing the "while loop" like this:
[initialiser goes here]
while([condition to be met goes here])
{
[stuff to be repeated goes here]
[increment goes here]
}


We all start out as newbies. What we have to do is keep at it.

>What's the alternative?
You could've used void instead of int.

>Isn't it better to have some error checking?
Yes. Thing is, you weren't using it as error-checking.
All the 1s and 0s were being spat back and ignored.
Really, though, that's just a nitpick on my part: it's there if you want it.

>The original Fizzbuzz description only goes up to 100 though
True. Not that you have to stop there. You can go up to a thousand if you really wanted to.
The main thing is that you're looking for things that can divide into 3 and/or 5 and correctly saying fizz and buzz to them.
>>
>>60293272
This is because rust wants you to use some functional programming practices
Thread posts: 313
Thread images: 57


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.