[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: 334
Thread images: 40

File: shig pee.jpg (133KB, 960x624px) Image search: [Google]
shig pee.jpg
133KB, 960x624px
Old thread: >>56624512

What are you working on, /g/?
>>
First for C.
>>
why is programming so boring?
the only fun parts is designing a solution to a problem.
>>
first for C++14, the best general-purpose programming language.
>>
I want a Visual Studio extension to monitor my coding style.

StyleCop seems to have silly things (it wants you to specific "this"), while ReSharper is massively overdesigned and invasive for my needs.

Any tips?
>>
>>56630658
First for QT Creator and WAMP cultism.
>>
>want a way of printing error messages in C
>everywhere says "printf(message)"
>error: printf was not declared in this scope
what
>>
>>56630745
#include <stdio.h>
?
>>
>tfw finally submitted to the Google botnet.
>>
File: evil retard laugh.gif (1MB, 256x196px) Image search: [Google]
evil retard laugh.gif
1MB, 256x196px
>>56630745
#include <stdio.h>
>>
>>56630745
>using visual studio
>>
>>56630745
Did you include the stdio library?
>>
File: 95.png (3MB, 1456x1100px) Image search: [Google]
95.png
3MB, 1456x1100px
Is C++ a good way to learn programming? I'm serious.

My background is chemistry and I just want to get into programming as a hobby.

Thanks.
>>
>>56630770
CodeBlocks actually.

>>56630777
Now I have and it doesn't complain.
>>
>>56630745
did you include stdio.h ?
>>
File: everyone so stupid.png (121KB, 359x414px) Image search: [Google]
everyone so stupid.png
121KB, 359x414px
>>56630777 (not checked)
>stdio library
>library
>>
File: paper.png (260KB, 527x535px) Image search: [Google]
paper.png
260KB, 527x535px
http://arxiv.org/abs/1609.04802

New image super-resolution technique for keeping outputs on the manifold of natural images. This looks like it could beat out waifu2x if trained on anime screenshots.
>>
>>56630783
Of course not.
C++ not difficult, but very big, and slower than C.
So, learn C. C much simpler, easy to learn and you can read a lot of code written in C, you can join FSF, you can contribute to many interesting projects. And of course use Free Software, I reccomend Gentoo GNU/Linux. Learn how to program on Windows much more difficult.
>>
>>56630745
include stdio
>>
File: m8.jpg (63KB, 611x715px) Image search: [Google]
m8.jpg
63KB, 611x715px
>>56630840

Thank you for help Punjab.
>>
File: 1463424692934.jpg (708KB, 1080x1920px) Image search: [Google]
1463424692934.jpg
708KB, 1080x1920px
>>56629106
>>56630151

Would really appreciate it if someone could help me or point me torwards the right direction
>>
File: Capture.png (19KB, 1166x156px) Image search: [Google]
Capture.png
19KB, 1166x156px
>suggested I use GLEW rather than GLAD to access OpenGL
>can't find anything like the GLEW equivalent of pic related, it's just checking if OpenGL features exist and checking version numbers
wat

>>56630783
If you're new to programming, you'll probably want to jump straight into making functions.
If you go with a C language, you'll likely end up with a lot more setup before you can start to build programs.

BlueJ with Java is great if you're just learning, since you can start making functions straight away. It's even so nice as to lay out a basic template for you when you create a new class in your program.
>>
>>56630783
C++ is old technology,
you can use wix or wordpress if you're edgy to code any kind of apps.
>>
>>56630861
>point me torwards the right direction
Just follow the meme arrows.
>>
>>56630770
But vs is the bes tide for c+ +programming.
>>
>>56630861
I would recommend the hacker known as 4chan.
legend says you can find him circlejerking in the /h/ futa and scat general board at midnight PST
>>
>>56630861
http://www.developingthefuture.net/disassembling-decompiling-and-modifying-executables/
This appears to be the sort of tutorial you're looking for.
It runs you through an example scenario of cracking a program.
>>
>>56630783
>>56630863
>>56630868

I'm retarded. I meant C#... it gives you an idea how new I am.
>>
>>56630881
As if I wouldn't already spend my whole night in futa and scat threads on /d/ and gurochan
>>
>>56630921
4chan? is that you?
i look up to your 1337 h4x1n6 skills
>>
>>56630919
That's a hell of a typo.

Yes, C# is a fantastic language to learn on.

Here's a free book that explains programming before you actually start writing code (link to PDF on page):
http://www.robmiles.com/c-yellow-book/
>>
>>56630691
desu that's what you do most of the time that you're making software. actually typing the code is like 30%
>>
https://www.youtube.com/watch?v=CNfazhgSwYM
This video is how I view the GitHub and Python programming communities.
>>
File: angry shig.jpg (36KB, 212x218px) Image search: [Google]
angry shig.jpg
36KB, 212x218px
>>56630996
>he doesn't implement fizzbuzz on meme languages for a living
>>
>>56630706
>while ReSharper is massively overdesigned and invasive for my needs.

You can customize ReSharper so that you're only using certain features of it. Fwiw, I love most jetbrains products (IntelliJ & CLion), but I prefer to use VS out of the box (with a few small plugins).
>>
what do you guys think of golang?

I made a 4chan shitposting bot last night and it's pretty fucking messy. It compiles to 8mb. That's a fucking sin.

https://github.com/normiesgetout/CTRbot
>>
>>56630805
stdio is a library idiot
>>
>>56631005
Real high-level discussions you guys have here.
>>
>>56631103
>literally woke her up, inside
>>
>>56630863
So, I don't suppose anyone here actually knows what GLEW does?

>>56631095
pic related
>>
File: 1449899606099.png (789KB, 1280x720px) Image search: [Google]
1449899606099.png
789KB, 1280x720px
int ret;
ret = do1();
if (ret) return errno;
ret = do2();
if (ret) return errno;
ret = do3();
if (ret) return errno;
ret = do4();
if (ret) return errno;
ret = do5();
if (ret) return errno;
ret = do6();
if (ret) return errno;
>>
Hey I have a console game that I'm writing in c#. Right now I have Screens that print and process input so like, main menu is a Screen, and battle is a screen.

the process input method takes a string, which is readline from the main loop and runs it through two sets of switch statements. The first switch checks what the screen state is, so like the battle screen could have character 1 view, where the switch statement would direct it so the print and processinput methods would match to the correct screen state. It then processes input and runs the methods.

I want to store the screen info externally though and have a single generic static screen that gets operated on in the game loop. Whats a good way of processing input for this? How do I direct stuff so that for example a character uses the correct attack, with the correct equipment, against the correct creature, all using a generic class thats just pulling data from text files?
>>
>>56631059
>It compiles to 8mb.
The fuck?

I'm writing a C# ETL tool that's about 3,000 LoC at this point with lots of 3rd-party embedded assemblies and it's at 3MB.

What does Go automatically embed in the output that's so fat?
>>
File: MaxResDefault(2).jpg (13KB, 360x360px) Image search: [Google]
MaxResDefault(2).jpg
13KB, 360x360px
It seems like every fucking job in my area wants a ".NET/C# master" all of a sudden, so give me suggestions on learning materials my dudes.
>>
>>56631152
see
>>56630943

MSDN has great beginner guides, too.
>>
>>56631150
Static linking + garbage collection meme
>>
>>56630700
Is your programming language programmable?
>>
>>56631186
All programming languages are programmable.
>>
>>56630700
>best
>general purpose
>language
this is bait

>>56631152
stupid moonposter, go back to /pol/
>>
>>56631200
moonmanposter*
>>
>>56631059
>I made a 4chan shitposting bot last night and it's pretty fucking messy.

Aside from some deep nesting, it looks alright to me. The whole 8mb executable, though, that's unforgivable.
>>
>>56631174
What exactly is being statically linked?

All of Go?
>>
>>56631220
there are no men on /pol/, just a lot of kids

>>56631122
int ret = 0;
for (size_t i = 0; i < 6; ++i)
if (ret = fs[i]()) return errno;
>>
>>56630745
>how do i google
>>
>>56631257
He is posting moonman, not moon.

moonposters are on /jp/ and /a/.
>>
>>56630745
>literally cant include the FIRST FUCKING HEADER ANYONE LEARNS TO INCLUDE
>>
>>56631257
I wish for loops worked, Anon.
>>
>>56631257
if(do1() || do2() || do3() ... ) return errno;
>>
>>56631122
>>56631288
Are you retarded, or what shitty language are you using?
>>
>>56631316
I'm using C. You can't use for loops if each function takes different arguments.
>>
>>56631307
Okay, that might work.
>>
File: Screenshot_20160916-174013.png (98KB, 1080x643px) Image search: [Google]
Screenshot_20160916-174013.png
98KB, 1080x643px
So now that Java is Carmack-approved (a guy that knows more about programming than all of you put together) when will you start learning Java, /g/? I think I'm going to install Android Studio and finally learn about mobile apps development.
>>
>>56631338
Can't you define an array of booleans in C as results of functions? Then you'd just check if any of a value is present.

Not C, but like this:
var checks = new bool[]
{
ReturnFalse(),
ReturnFalse1(),
ReturnFalse2(),
ReturnTrue()
};

if (checks.Any(x => true)) return errno;
>>
>>56631408

OH MY GOD! JAVA HATERS ON SUICIDE WAtCH! JAVA-HATERS LITERALLY BTFO BY CARMACK!

will they ever recover?
>>
>>56631408
The thing is java is ok language. It has "lots of libraries" but every fucking time you try to do something all the good libraries are for c++ and java might have library for "that" but it's not maintained anymore and fucking sucks.

>Android Studio and finally learn about mobile apps development.
Why not try to do cross platform "apps" instead of locking yourself to the most retarded one? You can do it in java too...
>>
I have design problem.

So I'm working on toy game engine. I have few instances and variables which are used by all classes, like texture manager, SDL_Surface, SDL_Renderer... etc, Currently im passing them around in constructors but its getting ridicolous.
Every time i want to create ingame object like player i have to call this monstrosity:
Object(TextureManager* tm, Animator* anim, SDL_Renderer* renderer, const std::string& textureName);


Where first 3 arguments only initialized once at start but i need to have reference to them...

How do i simplify this hell.
>>
>>56631287
thats why html is the superior programming language.

you can type html -> tab and it prints out all the headers for you.
>>
File: 1467131735909.gif (1MB, 640x360px) Image search: [Google]
1467131735909.gif
1MB, 640x360px
>>56631470
>The thing is java is ok language
>>
>>56631408
java is babies first languages
who doesn't know java?
>>
>>56631525
>java is babies first languages
>who doesn't know java?
Java is an abomination and if you fully learned it as your first language then you are cursed to poor programming practice
>>
>>56631517
Are you saying you know more than Carmack? Post your code so we can see what authority you have to criticize Carmack opinions.

>>56631525
Learning Java at college or with a tutorial to do a couple of toy projects is not really knowing Java (or any other language).
>>
>>56631200
it's not, ever since C++11 this language became really fucking good.
>>
Just started with SDL. Am I doing it right?
https://github.com/BobbyRaduloff/GameOfLifeC
>>
>>56631441
that would call all the functions instead of doing an early return
>>
>>56631566
>it's not, ever since C++11 this language became really fucking good.
no, it went from being shit to being mostly shit with some half assed implementations of good ideas
>>
what programiung langueage should i learn first?
>>
>>56631517
>implying
nice meme retard
>>
>>56631585
not Java and not Python
>>
>>56631585
COBOL
>>
>>56631574
It works just fine it seems, but i'm not too keen on your style. That's subjective though.

I wrote a much larger SDL project a few months ago if you want a look. It's far from perfect though.


https://github.com/TercioOfParma/Comp4Project
>>
>>56631585
java

NOT python

NOT haskell
>>
What can I use in C++ to achieve a VLA inside of an union?
>>
>>56631579
True, it's the pattern I use when I specifically want to avoid short-circuting, but I suppose the OP doesn't need that.

It's a tradeoff between data and speed.

Sometimes if an item fails a check like that, you also want to know what other tests it might fail for analytics purposes.
>>
>>56631599
>>56631603
>>56631610
i am learning this book https://hassanolity.files.wordpress.com/2013/11/the_c_programming_language_2.pdf
is this good
>>
>>56631507
Statically instance a class containing your manager classes then make a getpointer or you can use a pointer buffer. I know GLFW has it idk if SDL does
>>
>>56631583
have you really used it for an extensive amount of time since '11? be honest now.
>>
>>56631609
Style like my code?
I'll check out what you've done, though. Looks interesting
>>
>>56631621
it's fine
>>
>>56631635
Yeah, some of the things like placement of curly braces and a few non descriptive variable names.
>>
>>56631634
i've used it a fair amount from 2014 ish
>>
>>56631556
>>56631563

Java is just a language, you're not considered a good programmer if you know the entire Java framework by heart.

There are these things called problem solving and critical thinking skills.
>>
>>56631654
Just looked at your thing. Holy shit man, these are the most aesthetically beautiful source files I've ever laid my hands on!
>>
>>56631654
>>56631681
Was just about to compile it aaaaand windows.h ;-;
>>
>>56631634
Thats great idea!
SDL or whatever doesnt matter, most of hell i have to pass around is of my own making. Thank you!
>>
java has lambda expressions now
>>
Give me reason to learn Go.
>>
>>56631681
Didn't stop me from getting a D in it somehow, in spite of writing a 300 page report on its development.
>>
>>56631742
its super simple, takes 20 min to learn and can be used as less annoying version of python.
>>
>>56631338
Make a struct that contains all the arguments for all functions and then pass it to the functions? Each function uses only the members they need, leaving the others alone.

Messy, but it's just one struct.
>>
>>56631698
hasn't it had them for a few years?
>>
>>56631692
Remove the lines relating to moving the console in main.c and then remove the windows.h stuff and linking and it should work
>>
>>56631753
What are you using for creating levels?
>>
>>56631742
There's no reason to use Go.
>>
So I've started and stopped learning programming many times over. I understand the basics and feel I'm pretty handy with C (not perfect, but can get quite far).

My OO is pretty shitty though. I want to learn iOS/Android app development. I've followed tutorials and guides and started them many times but lose focus after a few weeks.

What do?
>>
>>56631622
In glfw it's called a user pointer. It's globally available it just needs to be casted from void.
>>
>>56631746
>300 page report

probably because no one wanted to read a 300 page report
>>
>>56631790
We had to write that, mine did have the highest word count in the class by about 4 thousand words though (not really saying much when most people were around 35k).
>>
I'd like to document my code in such a way that a non-programmer could understand what it's doing.

Are there any graphic tools to accomplish this?

I'm almost thinking a programming-specific Visio or Draw.io, but not for class-diagram.
>>
>>56631660
No. You don't have to know it "by heart", but you should be very familiar with the fundamental libraries. A programmer that reinvents the wheel because he doesn't know some built-in function does already what he wants or that needs to google how to do *everything* is an unproductive programmer.
>>
Please tell me that there's a better way than this:
    std::size_t longSize = sizeof(long);
union {
long value;
char bytes32[4];
char bytes64[8];
} block;


To get this in C++:
    std::size_t longSize = sizeof(long);
union {
long value;
char bytes[longSize];
} block;
>>
>>56631809
you can always use google, if you're familiar with programming in general you would know what to search for and get on with your day.
>>
>>56631770
Well I will go with java then.
>>
>>56631660
most people don't even know the language and the basic concepts properly, and it's not even a big language, it's a simple language on purpose
>>
>>56631849
Avoiding learning Java is a reason to learn Go

t. hater of Go
>>
>>56631859
this meme really isn't funny
>>
>>56631887
Nobody asked you rajesh
>>
How to multithread game engine? I cant figure out how to put it on more than 2 thread one main and one on everything else. All examples i found are contrived and too basic...
>>
>>56631807
>in such a way that a non-programmer could understand what it's doing
Are you teaching someone?

You might want to actually use Visio/Draw.io and just slap code snippets inside of flow chart boxes.
>>
>>56631941
Showing off the project to a non-technical manager.

I'm actually the only semi-experience developer at this company, so I'm trying to convey what actually is happening.

The issue is that draw.io and the like are difficult to map out timelines when things get multithreaded.
>>
>>56631759
i never got the update then. my minds mildly blown
>>
>>56631931
>2 thread one main and one on everything else
this is generally how you should do it. maybe one more for input.

multithreading in general is a meme. if you overdo it you tend to get a ridiculous amount of latency because you can't travel back in forth in time.

and for "truly concurrent" tasks you should probably run them on the gpu not the cpu, the cpu only has a few cores anyway
>>
>>56631985
and one thread for audio
>>
>>56631985
That explains alot. Thank you.
>>
>>56631963
>The issue is that draw.io and the like are difficult to map out timelines when things get multithreaded.
Unless you want to write out multithreading in English, you're probably gonna have to map out your threads. Can I ask what your project does?
>>
>>56631811
Replace longSize with sizeof(long).

also
>camelCase
pooInLoo
>>
>>56631823
If you need to google everything you're not better than someone that just got his CS degree or is still at school. No offense meant if that's your case.
>>
>>56632041
>PascalCase ftw

/s
>>
>>56632030
It's a Windows service with scheduled Quartz jobs based on day of week, time of day, and jobs that run every x seconds/minutes/hours.

These jobs do various things, but they are mostly for pulling information from on-premise databases and cloud APIs and staging that data into a local database for warehousing purposes.

The application also has utilities that can scan a MySQL or SQL Server database (only ones supported right now) and re-create temporal staging tables with system versioning so that the service and jobs have a place to ship and store their data.

Now, this is just the C# part of the project. There's also other components to map out, such as the table schemas within the staging layer, and physically where all the components are located.

I don't know, either way it's going to take a few meetings to get this through, but at the very least it helped to organize my thoughts by writing this post.
>>
>>56631931
Jobs.
>>
>>56632041
Right, that makes sense since it's gonna be a compile time constant and I can just use the variable later for memcpy, thanks lad.
>>
File: ann.webm (3MB, 640x360px) Image search: [Google]
ann.webm
3MB, 640x360px
/dpt/-chan, daisuki~

Ask your much beloved programming literate anything (IAMA)

>>56631931
pipeline

>>56631408
>"fully specified C"
i have found a major flaw in the java specification.
>>
>>56631985
Why one for input? That sounds stupid. You're asking for input lag caused by cross thread communication. Also don't see what the point of a thread for just input is.
>>
>>56630658
A USB authentication daemon for Linux. Prompts user for a password every time a USB device is connected to the computer, it only authenticates the USB if the password is correct.
>>
>>56632136
What cartoon?
>>
File: HntlKcy.jpg (56KB, 599x607px) Image search: [Google]
HntlKcy.jpg
56KB, 599x607px
>>56632207
https://en.wikipedia.org/wiki/Shimoneta
>>
>>56631850
Jesus I wonder what you consider a big language then
>>
>>56632084
If you're explaining code to a non-technical person, you want to keep everything in chunks. Threading is easier to explain when you're dealing with as few specific boxes as possible:

[x] section pulls information from other databases and our cloud services and stages it in a local database here. [y] section will scan the (My)SQL database.
etc.

If someone asks for further explanation about a certain chunk, you can get into the details from there. Don't be like the China at my job who starts off talking about programming specifics and tests to COMPLETELY non-technical people when they ask him what the general process for something looks like (it's as much of an abstract type of hell as it sounds like trying to salvage meetings, especially since I'm not even semi-experienced).
>>
>>56632185
that's how it is on android you have a UI thread and a rendering thread i guess on pc it's different if you just poll the mouse input and don't do any prediction, but you have to process keystroke events don't you?
>>
File: pointing filter merchant.gif (1MB, 320x240px) Image search: [Google]
pointing filter merchant.gif
1MB, 320x240px
>>56632136
Consider a one-time dosage of Parabellum.
>>
>>56632265
>that's how it is on android you have a UI thread and a rendering thread
neither of those are input threads.
>>
>>56632301
all input goes on the UI thread

the UI thread in an opengl es game is mostly just used for input
>>
>>56631985
>multithreading in general is a meme.
>>56632265
>mobile developer
Why should anyone listen to you?
>>
>>56632331
not an argument.
>>
>>56632321
>all input goes on the UI thread
yes, but also a shitload of other stuff. Almost nothing happens on the render thread on android.

>the UI thread in an opengl es game is mostly just used for input
I don't understand why this would be done.
>>
>>56632342
the render thread is the main thread in the context of a game, and then you would have a game logic thread, as well as the UI thread

>I don't understand why this would be done.
this is android101, you're not supposed to do any significant workload on the UI thread for responsiveness reasons
>>
>>56632358
I really doubt OP cares about Android.
>>
>>56632374
do you think input events on windows are sent to the render thread? lol?
>>
>>56632358
Why would handle all input on a thread called the "UI thread"? Why not call it the "input thread"? Do you do UI shit on this "UI thread" too?

>you're not supposed to do any significant workload on the UI thread for responsiveness reasons
You are confused at fuck. You keep going back and forth between android UI and openGL games.

OpenGL games almost always just use one thread, and maybe more if it's some kind of pretty decent game engine.

You've been talking about having an input thread that only handles input, and not explained why the fuck that would be useful. Nothing does that to my knowledge.
>>
>>56631931
To elaborate on >>56632121:

You have your main thread, and cores-1 worker threads. A job is just a chunk of work that executes on a single thread, potentially in parallel with independent work. You can have a central queue that all threads take work from, or more efficiently, a queue per thread with threads stealing work from other queues once their queue is emptied.

An API like futures is pretty good for this. You just async a function, a job is created, and you can wait for it to finish, map it, bind it, join multiple tasks, wait for the first of a set of tasks to finish, etc. The whole threading scheme is abstracted away.
>>
>>56632398
Most windows apps don't have a render thread.
>>
>>56632420
you're fucking retarded

the thread is called the UI thread on android, that's where the input goes, so you have a thread for input whether you like it or not, and you have a separate thread for the opengl context whether you like it or not

>>56632437
kill yourself
>>
>>56632374
I really doubt anyone cares about OP.
>>
>>56632456
>the thread is called the UI thread on android, that's where the input goes
It's not a dedicated input thread. It is the thread for everything. Hardly anything happens at all on the render thread in Android. The render thread didn't exist until they added the material design stuff.

>kill yourself
What is wrong with you? Most windows apps use GDI, which doesn't have a dedicated render thread. WPF does, but fuck all apps use that.
>>
>>56631408

>fully specified C

Yeah, if you include the sun.unsafe libraries.
>>
>>56632502

You could use C# instead, which has all that an more. :)
>>
>>56632489
i'm done wasting my time on you i'm closing this tab, this entire day has been a waste of time on useless idiots like you, you can choose to understand
>>
>what's the best way to do X in a game engine
>here's how you're mandated to do X in Android apps anyone not talking about Android should kill themselves Android Android Android
>>
>>56632514
Goodbye you useless shithead.

>>56632509
And it's an open spec. Less chance of getting sued for using it.
>>
I should do some daily programming. I want to, but at the same time i'm feeling lazy, and i don't have a clear idea of how i want to proceed.
>>
File: 1471035639918.jpg (12KB, 500x281px) Image search: [Google]
1471035639918.jpg
12KB, 500x281px
>>56632571
just do it faglord
>>
>>56632571
Here, I rolled a task for you:


Custom markup → HTML converterbonus: without using any regex longer than 10 characters

Invent your own markup and write a converter from it to HTML.
>>
Who /react/ here?
>>
>>56632571
https://sites.google.com/site/prologsite/prolog-problems

Try and solve them in your favorite languages.
>>
SCons is pretty good.
Thanks to the anon who mentioned it to me earlier.
>>
>>56632592
What made you think of this task?
>>
>>56632672
Literally nothing

https://better-dpt-roll.github.io
>>
To reply to >>56628822 since the topic got archived;

Noted! I'll take a look-see. I've tried googling stuff before but normally they'd be written in a different style so implementing it, I find, to be hard. Not sure why but either I didn't understand or the way I had learnt was clearly not good enough for me to properly understand the material.

>>56629679
Naw man, no one's offended 'round here I'd say. Normally when someone is quoting someone else there'd have the post tagged to show who they're quoting.

If it's just greentext like I did, then >>56629139
has it right on the mark.
>>
File: 20160909_114004.jpg (1MB, 2560x1920px) Image search: [Google]
20160909_114004.jpg
1MB, 2560x1920px
>>56630658
How can I draw the star of David insise a console program?

I thought about using a two dimensional array which I could fill in with a given char in the right places, but there has to do better way to do it..
>>
>>56632790
>star of David
it's literally just two triangles.
>>
>>56632790
Like what? Any raster graphic is fundamentally dealing with a 2d array.

>>56632731
I found another problem on that list that was very close to what i should be working on anyway.
>>
noob question about C

i have some structs and functions in a file and need to make a header to use them in another file

but in this other file i will only use like three or four of 20 functions, but these 3 or four do call some of the other 20 functions

will it suffice to declare only those 3 functions or do i have to declare everything

i hope you know what i mean
>>
more anime usenet stuff
>>
>>56631585
OCaml
>>
>>56632980
You only 'need' to declare the functions you are using. Just make sure that the 20 functions are defined in the right order or declare all of them at the top of your .c file to be save.
>>
>>56633014
Do you have a link?
>>
>>56633289
anizb dot org
There's probably a lot of broken shit
>>
File: fhex4.webm (507KB, 736x412px) Image search: [Google]
fhex4.webm
507KB, 736x412px
Added a save dialog that prompts you if you try to close the program with unsaved changes.
>>
>>56633389
I like it, never heard of .nzb before, cool
>>
>>56633463
What do you use to navigate? Look nifty
>>
>>56633493
It's a pretty decent way to download anime, but it does cost money just to connect to a provider. Usenet mostly sucks for western content though.
>>
File: output.webm (236KB, 640x480px) Image search: [Google]
output.webm
236KB, 640x480px
Post quoting works now!
>>
>>56633499
home-row h,j,k,l or pgup/pgdown
>>
>>56630861
What program?
>>
90% of what I've been doing the last week is writing stuff that shouldn't be written in awk in awk and then promptly deleting the scripts when they work.

My productivity has never been negative before.
>>
File: File Sep 16, 1 42 44 PM.jpg (2MB, 2448x3264px) Image search: [Google]
File Sep 16, 1 42 44 PM.jpg
2MB, 2448x3264px
Can anyone tell me what's going on here? I'm making an arduino motor controller with 'presets'

I use the interrupt pin so when the button is pressed, a count increments, then the if statements in the main loop reference that count to determine which preset to run

the issue is that I appear to be getting feedback from the motors when they're turned on. If the motors are disconnected, the button increments fine, but when the motors are connected I get a lot of random interrupts

Here's the expected serial output:
0
incrementing cycle
1
incrementing cycle
2
incrementing cycle
3
incrementing cycle
4
incrementing cycle
resetting count
0


and here's what it looks like when the motors are connected:
0
incrementing cycle //this is the only time I hit the button
1
incrementing cycle
2
2
2
2
2
...


I'm thinking it must be something with how I have it physically hooked up
>>
will programming help me understand what the fuck is going on in Mr Robot?
>>
>>56633678
and here's the code 1/2:
const int buttonPin = 2;
const int rotorMotor1 = 7;
const int rotorMotor2 = 8;
const int rotorPwm = 9;
const int vibMotor1 = 10;
const int vibMotor2 = 11;
const int vibPwm = 12;

volatile int count = 0;
volatile int setPwm = 255;

void setup() {
pinMode(buttonPin, INPUT_PULLUP);
pinMode(rotorMotor1, OUTPUT);
pinMode(rotorMotor2, OUTPUT);
pinMode(rotorPwm, OUTPUT);
pinMode(vibMotor1, OUTPUT);
pinMode(vibMotor2, OUTPUT);
pinMode(vibPwm, OUTPUT);

attachInterrupt(digitalPinToInterrupt(buttonPin), cycle, HIGH);

Serial.begin(9600);
}
>>
>>56633695
code 2/2:

void loop() {
if (count==0) {
Serial.println("0");
analogWrite(rotorPwm, 0);
analogWrite(vibPwm, 0);
delay(2000);
}

else if (count==1) {
Serial.println("1");
digitalWrite(rotorMotor1, HIGH);
digitalWrite(rotorMotor2, LOW);
analogWrite(rotorPwm, setPwm);
digitalWrite(vibMotor1, HIGH);
digitalWrite(vibMotor2, LOW);
analogWrite(vibPwm, setPwm);
delay(2000);
digitalWrite(rotorMotor1, LOW);
digitalWrite(rotorMotor2, HIGH);
digitalWrite(vibMotor1, HIGH);
digitalWrite(vibMotor2, LOW);
delay(2000);
}
else if (count==2) {
Serial.println("2");
digitalWrite(rotorMotor1, HIGH);
digitalWrite(rotorMotor2, LOW);
analogWrite(rotorPwm, setPwm);
digitalWrite(vibMotor1, HIGH);
digitalWrite(vibMotor2, LOW);
analogWrite(vibPwm, setPwm);
delay(2000);
}
else if (count==3) {
Serial.println("3");
digitalWrite(rotorMotor1, LOW);
digitalWrite(rotorMotor2, HIGH);
analogWrite(rotorPwm, setPwm);
digitalWrite(vibMotor1, LOW);
digitalWrite(vibMotor2, HIGH);
analogWrite(vibPwm, setPwm);
delay(2000);
}
else if (count==4) {
Serial.println("4");
analogWrite(rotorPwm, 0);
analogWrite(vibPwm, 0);
delay(2000);
}
else {
Serial.println("resetting count");
count = 0;
}
}

void cycle() {
static unsigned long last_interrupt_time = 0;
unsigned long interrupt_time = millis();
if (interrupt_time - last_interrupt_time > 500)
{
Serial.println("incrementing cycle");
count = count + 1;
}
last_interrupt_time = interrupt_time;
}
>>
File: dammit kyouko.png (386KB, 507x767px) Image search: [Google]
dammit kyouko.png
386KB, 507x767px
>>56633694
No, for that you need to study existentialism and deep math
>>
Ive learned all the java syntax but have barely done any actual programming so I only know stuff in theory, how do I go about learning how to actually code?
>>
>>56633814
You could try writing programs that solve specific problems.
>>
anime kills brain cells
>>
>>56633845
i watch anime and i have a 3.9 gpa
>>
How do I into vim? I try to use it but I end up spending all my time in insert mode and occasionally using the replace command.
>>
>>56633814
try doing problems on websites that give you test problems, like hackerrank. i need to get used to not using an IDE since apparently they aren't allowed in google interviews
>>
>>56633854
That doesn't even contradict his point. Maybe you would have realized that if you hadn't killed so many brain cells.

http://arstechnica.com/biology/2016/07/japanese-animation-effects-on-brain-development-new-findings
>>
>>56633814
make a program that you will use

it could be porn related, or some simple game youd like to have

i made a scraper once to download images from a sit ei liked, or i made a program that splices two porn pictures together

i like tetris so i made a clone of that too

whatever im sure you can find a functionality you can implement in your particular way, if so tell whta it is i might like to make it too
>>
>>56633895
9/10
made me click
>>
>>56633867
obligatory info: vimtutor for learning vim

>I end up spending all my time in insert mode
Does that mean you're navigating with arrow-keys? You should learn to move with h,j,k and l keys.

Also if you want to learn useful vim comments take a look here: http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118
>>
>>56633867
$ vimtutor
>>
>>56633907
>i made a program that splices two porn pictures together

But.. why?
>>
>>56634075
>>
after roughly 18 months of writing business quality code in C#/.NET I am decided

I will spend the remainder of my career avoiding it like the motherfucking plague. even if it means I can't find work.

I would rather flip burgers then work with this fucking trash build system ever again. fuck all this and fuck microsoft.
>>
>>56634121
learn some other langs, code stuff for android/linux/ios, etc. would help, I suppose
>>
>>56634121
Why? For me it's been kinda fun, since C# is comfy.
>>
>>56634121
just make websites lmao
>>
>>56634121
So the only reason you hate .NET is because of the build system? There are alternatives like FAKE for building .NET projects.
>>
FUCKING HELL, I keep procrastinating ;_;
how the FUCK do you guys not get distracted when doing your own projects? this shouldn't be difficult, at all. FUCK.
>>
File: 44.jpg (13KB, 225x225px) Image search: [Google]
44.jpg
13KB, 225x225px
>tfw you get better at a language and you refactor your old code, to make it more readable, shorter, more easily adjustable, and sexier
>>
>>56634224
if you're not enjoying it you're doing it wrong

I enjoy programming so I will generally do some each day or read about a new language/technique
>>
>>56634145
not getting paid to write those sadly

>>56634152
C# is actually pretty good but VS and .NET are total dog shit

>>56634155
n-no
>>
>>56634121

Try out Mono.
>>
>>56634260
>VS and .NET are total dog shit
why
>inb4 muh bloat
>>
there's absolutely nothing wrong with being a web developer
>>
>>56634231
haskell?
>>
File: 61.jpg (6KB, 250x250px) Image search: [Google]
61.jpg
6KB, 250x250px
>>56634289
yes friend
>>
>>56634292
post code
>>
>>56634305
It could be better when I get more adept with monads but it's far nicer than it was before I changed it

http://pastebin.com/av3fXTER
>>
>>56634345
M A Y B E T I O
A
Y
B
E
T
I
O
>>
How do I get:

<td>
<?php echo $row['status']?></td>

A certain 'status' to be the color green? The output is from sql 2008.
>>
File: 74.png (306KB, 975x1045px) Image search: [Google]
74.png
306KB, 975x1045px
>>56634358
this looks interesting, thanks, I will look into it
>>
>>56634345
>case (maybe) of
>nothing
>just (perform action)
You can use mapM or traverse here too, maybes are containers

in handletags I think there's a possible fmap?


You could use monad transformers too, so rather than switching from monad to monad you can just do

valueInsideJust <- aMaybe
performIO valueInsideJust
>>
>>56634390
Whenever you see something like
IO (Maybe a)

or
State s (Reader r (Either a b))
or whatever you should look into monad transformers.
>>
hello dpt

im looking for a c++ projects lists sorted by difficulty level any one know any good resources
>>
>>56631599
>>56631610
>literally be first year in IT study
>college degree and shit
>learn Python as first
>C# and HTML and others later years

I am fugged am I?
>>
>>56634242
>if you're not enjoying it you're doing it wrong
I want to make useful things, but, seriously, why is it so difficult to even FIND information? let alone useful libraries. all the "technical" meme speak in different languages just obscures information. it's like people don't even care about those who are trying to learn anymore. or perhaps I'm the one who's too flustered and wrong, I'm trying to do things the easy & fast way, and end up confused and doing nothing at all
I dunno what to think anymore. also, my social status (poor NEET) doesn't help me at all
>>
I met a qt grill in college and now think that girls (and other normies) won't give a shit about how good you program if the UI doesn't look really good. If the ui is just generic (like ligthly styled Bootstrap for a website), then your program is just nerdy shit.
>>
>>56634385
if ($row['status'] == "OK") {
echo "<span style=\"color: green;\">" + $row['status'] + "</span>";
} else {
echo $row['status'];
}
>>
>>56634533
Thanks anon
>>
>>56634436
>literally
You're already going to drop out and flip burgers, it doesn't matter what you start with.

(No. Any school that doesn't have its head up its ass will go head over heels to not teach you anything extremely language specific as you go through the degree. You're supposed to learn more of the critical thinking and problem solving aspect from each course. Language wars are just bikeshedding (look it up) for the most part.)
>>
>>56634528
Yeah, people are superficial. Surprise. Idea is that it doesn't matter unless they are there to give you money.
>>
>>56634528
Protip: companies don't hire graphics and UI designers because programmers/engineers enjoy their presence
>>
>>56634552
*for the most part in college/uni
>>
>>56634260
>VS and .NET are total dog shit

Lies.
>>
>>56634552
Feels quite good because my course will teach me network engineering, hardware building and maintanance, software engineering (I gonna choose this speciality) and IT bussiness managment in four years.

If this wont give me a job I will kill myself. Python is fun though.
>>
>>56634528
this is obvious. people don't understand how the technical stuff works, they just want it to work. for them, you are the "guy who knows about computers", and computers work magically.
your efforts don't really matter to anyone, it's the end result that matters.
even more... marketing and even brainwashing matter as much, if not more, than technical stuff, at least for businesses. you have to CONVINCE people that your shit is useful.
>>
>>56634621
>If this wont give me a job
Degrees don't automatically give you jobs - you get yourself a job by putting in WORK.
>>
>>56634699
We need to study and work at the same time, some kind of merchant school. Fuck I really dunno how to explain. We'll get detached to companies and therefore learn how to work for a company and learn to program at the same time.
>>
>>56634533
I tried this, and it just shows a '0' in front of the status I need.

This is in PHP right?
>>
>>56634712
>We'll get detached to companies and therefore learn how to work for a company and learn to program at the same time.
Oh that's cool, kind of like work/study (where you get a part-time job somewhere on or near the school campus to pay part of your bill) but actually beneficial. Just don't lose your mind about falling for memes and you should be ok.
>>
>>56634743
Yeah like that.
>>
>>56634726
This is because he used + instead of .
>>
File: C9F.jpg (111KB, 776x1100px) Image search: [Google]
C9F.jpg
111KB, 776x1100px
>>56630658
Why does some people always to use the private keyword for members in C# classes, don't they know that's the default visibility for them?
>inb4 explicit > implicit
>>
why should i not use
 using namespace std;

and use std::cout instead?
some one told me not to use namespace but dident explain why
>>
>>56634812
Consider what happens when you have two libraries that have the same class name or a variable contained within their respective namespace and then you use using namespace <name>;
>>
>>56634782
Who is this cutie patootie?
>>
>>56634865
megumin from bakemonogatari
>>
>>56634865
IDK man, looks like a ship girl (kancolle, judging by the thing of her hair).
>>
>>56634849
gotcha, thank you senpai
>>
>>56634767
That did the trick! Thanks both of ya.
>>
>>56634782
Because it's easy to tell immediately if it's intentional or not.

Also, different languages have different defaults, so it's easier to read for someone who uses many different languages.
>>
>>56634782
i love tight anime butts
>>
>>56634782
Because they are stupid fucking retards.
>>
File: SlidingPuzzle.jpg (172KB, 1680x1050px) Image search: [Google]
SlidingPuzzle.jpg
172KB, 1680x1050px
Working on this 15 piece sliding puzzle atm
Does anybody know whether you can randomly distribute all the puzzle pieces and still have it solvable?
>>
File: 112.jpg (56KB, 505x388px) Image search: [Google]
112.jpg
56KB, 505x388px
>>56634402
>>56634408
took me a while, but I managed to do it now. There weren't many examples to use as reference, I guess it's not used that much. Monads are confusing
>>
>>56635474
Any random arrangement is solvable (https://www.cs.bham.ac.uk/~mdr/teaching/modules04/java2/TilesSolvability.html)

Also you have 16 pieces in your screenshot.
>>
>>56635578
Thanks
I also DO realize that there are currently still 16 pieces
>>
Should I use my real name on github?
I want to include my github in my resume, having a nickname seems kinda unprofessional.
>>
>>56635602
I used my initials as words as I'd rather not use my full name

example: Tea Be for initials T.B.
>>
>>56635602
>mfw I use a nickname and anime avatar
>>
>>56630658
Is there a way to validate a SecureString? Like, I just wanna the user doesn't enters whitespaces.
>>
i'm trying to make a booru crawler. there are existing ones but they're in python and i'm alergic to python so it's C or bust. but i don't get this damn libcurl. i have this CURLcode (probably) extracted, what can i do with it now?
>>
>>56635602
If you have it on your resume then yeah.
>>
>>56635602
I use a random name... I guess I should change it, lel
>>
>>56635602
I use my fill first name and the first 3 letters of my second name.
>>
>>56635907
are you downloading a page with your tag of choice, then trying to extract links from it?
>>
>>56634528
The program's gotta look good AND work good. Users don't understand the difference.
>>
File: prpE0Mt.jpg (387KB, 1195x1593px) Image search: [Google]
prpE0Mt.jpg
387KB, 1195x1593px
>>56630745
Listen nigga, I don't know shit about programming in C (Javascript pleb here) and even I know you have to include stdio.h in your code to have most basic shit like printf() working.
>>
>>56635907
xddd
>>
File: 1236818.jpg (113KB, 960x720px) Image search: [Google]
1236818.jpg
113KB, 960x720px
You guys really should have some kind of sticky.

Anyway, my only "programming" experience is Javascript (and mirC script). I want to try something more advanced, but I don't know what to choose. I was thinking about either Java/C# or Python. Any recommendations?
>>
>>56636045
i'm trying to extract a full link from json file and put it in the string so i can parse it properly but i'm not sure what this damn curl is actually doing
>>56636291
KYS
>>
>>56636304
C#. Time to learn the power of Static Typing.
>>
>>56636304
>Java/C# or Python
Just throw your keyboard away.
>>
>>56636336
>I refuse to use the right tool for the job, instead I am going to use the wrong tool for the job while not knowing anything about the tool.

And yet you're telling others to kill themselves, very interesting.
>>
>>56636304
You can always consider plain old C.
>>
Im working on a web app, made on Ruby On Rails for 6 months, in my new job. They have 15 programmers for a single easy app, and they have ZERO tests.

I have no fucking idea how to convince them to do it anymore. Always the "there is no time" excuse.
>>
>>56636358
>what is learning
choke on your spoon
>>
who here /osdev/?
>>
>>56636395
and you can shove CURLcode up your butt :^)
>>
Somehow, I want to dynamically create passwords based on your progress in this game that I'm making.

Your progress is checked simply with:
level1_complete = True
level2_complete = False
level3_complete = True
level4_complete = False
level5_complete = False
#game is not linear


Passwords need to output to Integer-filled arrays like [1,7,9,16,22], as an example, based on what's True and what's False. They always need to be different. Them being different is the biggest thing, does anybody have any idea how I can do this?
>>
>>56636443
just admit that you have no fucking idea how to do it
> :^)
die
>>
Write a program that stores the values 'X' and 76.1 in separate memory cells.
Your program should get the values as data items and display them again for
the user when done.


How do I approach this in C? Do I declare a char with a value of X and a double with a value of 76.1 then just printf them to the console? I'm not too sure what theyre asking
>>
>>56636336
I can't say I've used your library, but I believe curl just downloads the page same as any other way. I did something similar to this in hasklel for rule34.paheal. Just pop your url into curl, and save it into a file, then open the file and start parsing. It might be easier if you have a library to help you with parsing, I used tagsoup, it looks like there are libraries for C as well.

You might want to open the downloaded page in a text editor so you can find out an easy way to get your links out by filtering between tags, etc

Hope that helps, idk exactly how you're trying to do it
>>
>>56636467
bit flags.
level one is bit 1, level two bit 2 etc.
so: 01011 is binary code for having completed level 1,2 and three (counting from right to left in binary)
then just convert it to an integer, maybe add a prime to make it less obvious what you're doing if that is important.
>>
>>56636475
I mean if the concept of using a package manager to install a library and then passing an option to the linker is too hard for you then maybe you should get back to the basic before attempting to use the wrong tool for the job.
>>
>>56636513
>maybe add a prime to make it less obvious what you're doing if that is important.
that is a major thing that I neglected to mention, it should be unpredictable so that passwords can't be easily guessed.

I don't get how to do binaries with Python, so I will read up on some things based on your advice.
>>
>>56636467
first person to respond to you had a good idea, the other way is generating random numbers with a fixed seed, and taking the nth number to be the nth level password

This would only work if you do the levels in order though
>>
>>56636540
>it should be unpredictable so that passwords can't be easily guessed.

Why does it matter so much?
>>
>>56636304
C#
>>
>>56636508
might try saving to the file, why not. i have stuff ready for parsing

>>56636523
>using a package manager to install a library and then passing an option to the linker
nice job, pulling things out of your ass and completely missing my point. kudos to you
>>
>>56636561
It's a video game and it's tradition that video game passwords can't be guessed so easily.
>>
>>56636569
Been a while since i've used C, but I think you could just run
system("curl "www.website.com" > file.txt");

or something like that. Not sure why you had to install curl from source though, didn't you already have it on your system or at least in your repos? Or are you using windows
>>
>>56636569
I mean the point doesn't really have any signifance here when I'm discussing with a person that cannot even open the documentation which thrououghtly explains it.
>>
>>56636579

You could make it fun by having the password be a string of words, and each level has its own magic word. Then the order of the words wouldn't matter, and it'd require a lot of testing to determine which word is actually the password.
>>
>>56635532
Monad transformers are all over the place.
>>
>>56636636
I meant just the maybeT, I didn't get many results searching, and the documentation was sparse. Maybe it's because i'm using cuckcuckgo
>>
>>56636602
>calling curl instead of using libcurl

puking_anime.png
>>
>>56632790
magyar?
>>
>>56636663
I'm not a C fag, idk how they do it
>>
File: 1466212127694.jpg (247KB, 1224x1445px) Image search: [Google]
1466212127694.jpg
247KB, 1224x1445px
>>56636602
anon, plz...that's the easy way
>>56636605
pic related or learn to read properly
>>
File: password.jpg (36KB, 524x280px) Image search: [Google]
password.jpg
36KB, 524x280px
>>56636632
I already have designed this wonderful password input system. You click on black squares and it appends integer values to an array based on which square you clicked and then the square turns green (graphics are work in progress).

I am adamant on doing a password system because it's something I really want to see in a game again, but it really is a huge hassle. Modern "save data to harddrive" systems are WAYYYYYYYYYYYYYYY easy.

You beat levels 1, 2, and 3? Well, let's just say that verbatim to your harddrive. No password algorithms involved.
>>
>>56636649
You could use ExceptT from
https://hackage.haskell.org/package/mtl

if you want interesting error values (n.b. ExceptT () is like MaybeT)

or just this:
https://hackage.haskell.org/package/transformers-0.5.2.0/docs/Control-Monad-Trans-Maybe.html
>>
>>56636669
>how they do it
>implying this is correct in any language

If you are using any language (shell scripts excluded) where its idiomatic to call processes like that instead of using a library or module, just stop.
>>
>>56636477
#include <stdio.h>

int main()
{
char x;
double t = 76.1;

printf("This is a test for the char %c and the double %f");

return 0;

}
>>
>>56636540
>>56636513
another thing to make it less obvious, leave bits out:
Level: 1 2 3 4 5 6 7 8
0 0 1 1 0 1 0 0 1

Do something like:
Level: 1 2 _ 3 _ 4 5 _ 6 7 8
0 0 0 1 1 1 1 1 0 0 1

The advantage is, the unimportant spaces '_' can be generated randomly and still be decryptable.

>>56636679
that is overly comlex, do you really evpect the average gaymer to be able to remember which cells in a 5x5 grid are filled? Thats way harder than say 4 or 6 hex characters, which is what many old games did.
>>
>>56636679

Alright, well then my suggestion wouldn't work. Would be neat, though. You could've had level 3's password be "hippo" and then generate strings like "hippo parakeet deer moose", "groundhog deer hippo aardvark", etc.

That'd require quite a bit of probing to find the actual password.
>>
>>56636723
>didn't give the arguments to printf
>>
>>56630745
This is a complete shot in the dark, but perhaps you didn't include stdio.h
>>
>>56636750
I'd be more worried that he didn't actually store a char with the value 'X'
>>
>>56636304
between those, go with C#. and please don't say "Java/C#", you're triggering me. they're similar in a lot of ways but there are some major differences, and C# is better in basically every way. it's not fair to lump them together
>>
>>56636678
I mean whatever, good luck anyway, you'll need it.
>>
File: neuron_diagram.jpg (12KB, 375x374px) Image search: [Google]
neuron_diagram.jpg
12KB, 375x374px
>>56630658
A custom iterator for permutations of elements in a single container and a contexpr LookUpTable for signal attenuation of neural signals for a strong AI that can ASK QUESTIONS and fucking DREAM...

Envy me.... ya SQL deadbeats!
>>
File: Untitled.png (10KB, 537x404px) Image search: [Google]
Untitled.png
10KB, 537x404px
>>56636729
I do not comprehend this, but I am reading up on bit flags. Thank you for this.

It's actually more than just "I want to see passwords again," the real reason for it is that I feel modern save systems ruin your experience with a game. I kind of WANT you to not bother with a password so that you'll play through the game from the start again. I don't intend the game to be super long, you're supposed to beat it in a single sitting, but if you do absolutely have to put it off for another day and really want to continue from that point, you use the password system.
>>
>>56636851
those wonky lines are triggering my ocd
>>
>>56636750
>>56636762

Can you guys point me in the right direction please? Sorry I'm still learning and I'm unsure what it is the book is asking me to program exactly. Any help is appreciated
>>
>>56636903
How far in are you? Have you done pointers?
If not it is probably literally asking you to declare variables and printf them
>>
>>56636903
This code sounds like what it wants
#include <stdio.h>

int main()
{
char a = 'x';
double b = 76.1;

printf("The character a = %c, and the double b = %f\n",a,b);

return 0;
}

When it says store them in separate memory cells it sounds like just an odd way to mean two different variables.

Printf uses formatting strings to show variables, %d is for an int, %c for a char, %f for a float/double, etc, and the \n prints a newline in your terminal
>>
>>56636937
thanks
>>56636960
Ah I see thanks. Still getting used to the way the questions are asked.You used %c in the printf statement to show that it's a character stored in char a and the %f to show it's a decimal stored in double b.
>>
>>56636937
who needs pointers anyway? aside from forced usage in some functions, they're pretty much the goto's child
>>
File: 1467019345752.jpg (10KB, 180x157px) Image search: [Google]
1467019345752.jpg
10KB, 180x157px
>>56637205
>who needs pointers anyway?
>>
I want to make a multiplatform map app. would it be too ugly, for the mobile platforms, to simply have the a webserver running in the background (serving the tiles), and use a webview to display it?
>>
>>56637218
no, seriously. they're pretty much useless in the early stages of programming
>>
NEW THREAD!

>>56637274
>>
>>56637259
As soon as you move from your fizzbuzzes and toy programs, they become absolutely essential.

If you don't have at least 3 layers of indirection between your pointers and the originating memory address they refer to, you don't know shit about programming.
>>
File: question cat.jpg (7KB, 220x230px) Image search: [Google]
question cat.jpg
7KB, 220x230px
Bjarne's book on sepples told me to write a function with no return value using void. So I tried this in Visual Studio:

void write_sorry()
{
cout<<"Hello.\n";
}
write_sorry();


But I get an error that the function is missing a type, and that is must return a value. BUT ISN'T THE WHOLE FUCKING POINT OF VOID THAT "VOID" IS THE TYPE AND IT DOESN'T RETURN A VALUE?! What is going on here?
>>
>>56637302
nonsense. you can easily skip them without losing anything big. modern languages did everything to reduce the neccesity of using them to bare minimum because everyone was sick and tired of moving the pointer every single damn time
>>
>>56637152
The printf function can display data differently.
For example
int var = 3847;
printf("%d - %f - %X - %c\n", var, var, var, var);

Will print the same variable 4 times but interpret/display it differently each time.
the output will be:
3847 - 0.000000 - F07 -    

>3847
the first is obvious, we declared the int to be 3847 and %d displays it as a decimal, so it outputs 3847

>0.000000
the %f will interpret a value as IEEE754 floating point number, which var is not. This doesn't generate any errors but will display var in a way we didn't want to. It's like binary and decimal 1001 can be both, a binary or a decimal number, depending on how we interpret it.

>F07
the %X will display our var as hexadecimal. If you convert 3847 from decimal to hexadecimal in a calculator it will also result in F07, the value is still the same, just the way we display it has changed.

>
The %c tries to display our var as an ASCII character. Since 3847 is way out of ASCII range there was nothing printed.
>>
Any good resources for learning Swift?
>>
Hi guys, a total newbie here.

Is Eclipse a good editor? I'm not searching anything fancy just something that it works how I would like it should work.

I'm initiating in programming with Java and I'm doing some curses for unemployed persons that my country offer. The only one I did used Eclipse in class and seems cool, but I don't know if I should stick with it.

Opinions?
>>
>>56637581
its not an editor, its an IDE. Its okay I guess.
>>
>>56637598
Sorry, I'm very new still. And IDE is like an environment to work with one or some languages, right?

In case I'm right, is Eclipse any good?
>>
>>56637378

If you really need to do this, use a union, please.

https://gustedt.wordpress.com/2016/08/17/effective-types-and-aliasing/
>>
>>56637923
I'm just explaining how printf works.
>>
>>56637952

You could just use different data types instead of doing dangerous silent casting with a value.
Thread posts: 334
Thread images: 40


[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.