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

Alright, well, I came here reluctantly because every other time

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: 29
Thread images: 2

File: newseventsimages.jpg (91KB, 700x484px) Image search: [Google]
newseventsimages.jpg
91KB, 700x484px
Alright, well, I came here reluctantly because every other time I've been on this board I've been called a faggot and told to kill myself. Which is understandable because I was asking for help, I'm a skiddie, etc. But tonight I come because I've started to take the steps to get out of the skid-zone. I'm trying to learn C++, and after I've become proficient in it, I have other languages in my queue (C#, Python, VBS, etc.).

I was wondering if anyone had any tips, because I'm halfway through this first course and I feel slightly retarded when it comes to why you even need headers (.h files) that #include another .cpp file, to then compile all of that to another .cpp file. It just seems like extra steps to me.

And also, if anyone can suggest other languages to learn so that I'll have a chance in the vast IT field.

Any help or stories would be greatly appreciated.
>>
start here
https://www.youtube.com/watch?v=tKTZoB2Vjuk
>if you can't finish this, then kill yourself
>>
>>62360318
I know I can probably do a google search and get general answers to this question, but I'm going to ask you anyway - what kind of stuff can you do with Python? Like how is it different from C++?
>>
>>62360362
It prototypes a hell of a lot faster than C++ but it's difficult to make it do non-trivial things efficiently.
i.e. it's quick to make stuff in python but a well made C++ program will work better
to be honest the only surefire way out it to just do stuff. doesn't matter the language, just learn stuff, program stuff, and don't be afraid to try new (to you) things. Also try to make sure you have stuff under your belt from low level to high level. Know how to write a memory allocator and use a web framework.
>>
>>62360467
Thank you. I plan on learning the languages I have listed, but I read that there's no way to really be an expert
>>
>>62360303
C++ feels complicated because it is. It's old as shit and is full of pitfalls. You need to learn it though, because actually understanding how C++ works will give you great insight into how a computer and a program work. Python can do everything C++ can do, and it can do it with less headaches, but Python achieves this by isolating you from the computer hardware. Generally the higher your abstraction level, the worse your performance. So it can be harder to get the same performance level of well-written C++ code in Python. Usually this doesn't matter though, because your time is usually worth a lot more than the computer's time.

You have a long road ahead of you. Learning to program well will take thousands of hours to do. My advise on a high level would be to not worry much about the language you're using. Focus on learning engineering and design principles and patterns. Learning to solve problems in a maintainable way is worth more than learning the syntax of 100 languages.
>>
>>62360303
What ever you do, do not get into templete meta programming. Also avoid boost like the plague. Also std::vector<bool> is not a vector of bools.
>>
>>62360647
I appreciate it, and to be honest this is the sort of shit I've wanted to do since i was in the 6th grade but I never really knew where to start. I'm 20 now and still able to learn, and my current job permits me a lot of free time on the computer to take course or practice or whatever I need to do. Trust me when I say i'm ready for the thousands of hours.

And how would you recommend I go about the learning engineering and design principles and patterns?

>>62360665
What's template meta programming?
>>
>>62360303
kys faggot
>>
>>62360518
I know this is going to sound facetious, but what do you mean by "learning", and what do you mean by, "proficient"? Going through a book and never making anything yourself isn't "learning" - so what have you planned to make for each of the languages you've listed? What are the things you're going to make going to teach you about the language, and programming in general? Like, you must have heard something about each of those languages that made you go, "that sounds cool, I'm going to make something with that concept", right? You haven't just picked a bunch of languages out of nowhere, or because it seems like the cool kids are learning it, have you?

This comment >>62360362 is pretty concerning because it seems like you know nothing about Python, but you want to "learn" it. You really should be trying to learn with more purpose than that.
>>
>>62360303
here is some advice. try to avoid going into GUI with c++.
>>
>>62360889
Do what you're doing. Get your feet wet. Do simple exercises like implementing a linked list, a compression function, a little text based game, etc. Learning by doing is important, and you can't really learn good design without making the mistakes of bad design first and realizing why what you did wasn't a good idea.

I really can't help beyond that. Not just because it's really not possible to distill what you need to do into a post, but also because it's best you explore this on your own. I gave you a direction with those key words. If you follow them then you should be on the right track.
>>
>>62361274
Okay, I get what you're saying, but at the same time, I gotta reiterate that I'm just jumping into this headfirst. I have a specific design in mind that I believe is going to need use of C++ and VBS, but I'm not sure what else yet. I'm trying to learn along the way, and at least get the syntax down so that I know where to start or practice if that makes any sense.

And yes, I've been a skid for a while now; known just enough to seem like I 'know lots about computers' to everyone else, but really just enough to do stupid shit and get myself fucked. So I don't know exactly what Python is, but I'm interested in learning what it could have to offer in future products or designs that I might want to pursue.
>>
>>62361310
Do you mean like working in a program like Visual Studio? Or you mean coding GUI with C++?

Sorry if that question was cringe-worthy
>>
>>62361353
don't worry you're good. its both. since i've tried both and they just go through so many libraries and specific tasks, its not beginner friendly at all and you need experience and extended knowledge of what you're working with. all i'm saying is, stick with the command prompt and stick with it for a while. it will help you learn a lot.
>>
>>62360303
C++ inherits C's dated compile-and-link model, that's why you need prototypes and headers.
>>
tl;dr
kys
>>
>>62360303
If you think C is too complicated, try learning BASIC. Also If you have difficulties understanding how including functions work, watch the MIT SICP course on youtube about LISP, it's basically the best thing you can do If you're totally new to programming
>>
kill yourself faggot
>>
File: C++.jpg (828KB, 1664x2450px) Image search: [Google]
C++.jpg
828KB, 1664x2450px
>>62360303

C++ is kewl, but not easy.
If you want to go that route take pic related.


Other worthwhile langauges?
Well, with C#, Python and VBS you're pretty well equipped actually.

Maybe learn Java, it's very similar to C# and if you can do C#, you can learn Java in no time.
Or maybe start with C? It's a good introduction for C++. They are different, but if you don't like C, you won't like C++ either.
Or learn Lisp with SICP, it's great.
Then you have of course the whole JavaScript/HTML/CSS circus, it's a lot of tiny things to know and JS is kinda meh, but it will land you a job sooner or later.
>>
>>62360303
>why I need these files
When your program becomes huge and you keep everything in one file, it becomes a mess. You can separate your functions into other files and have them as some sort of logical units.
>why do I need .h
If you just look at the .h file, you can immediately have some sort of idea what .cpp does. You know what functions it has and what it returns. It's like an overview of a .cpp. You have to be very careful and pick meaningful names for functions, then .h becomes very useful.

Languages have very similar syntaxes. Learning a language will take you a week, becoming a good programmer years. Learn data structures (linked lists, vectors, hash tables, hash sets, etc) and some algorithms. Also, don't stay at OO only languages. Learn functional features too, it will broaden your knowledge. Functional languages feature: higher order functions, lambdas (closures), persistent data structures, no side effects. Haskell is an example of a purely functional language, but it is very difficult. I recommend you to familiarize yourself with Rust and then head to Rust's functional features in its official book.

Good luck.
>>
>>62360665
Then what is the vector if it's not of type bool
>>
>>62364665
It's a bitfield.
That's a good data structure but it's also not a vector of bools.
>>
>>62361456
Okay, I shall. Thank you

>>62363406
Okay, that makes sense

>>62363478
Will check out right now, thank you

>>62363575
Duly noted. I'm gonna price up those books or see if I can't find them online. And I was thinking Java, but idk. And I'll have to research what Lisp is

>>62363676
I kind of had an epiphany last night and realized what you said here. From what I can tell, in this basic cmd game that the course has me doing, the main.cpp initiates everything and prints out text and takes in user text, but the other .cpp has all of the functions that process the information gathered from the main.cpp. I think I'm good on that for now

>>62361154
>>62363448
>>62363516
Fair enough
>>
>>62360303
What you're being confused about is actually the most retarded part of C++ and the reason why it compiles so slowly(the other reason being templates). It's a good sign, you have some common sense. Basically, you need headers when you want something to be visible in multiple cpp files.
>>
>>62365102
Link to these docs?
>>
>>62365239
Unless you understand the linkage model of C and C++, you're going to be very confused by the whole idea of headers and what you're supposed to do with them.

Let's say you have two .cpp files.
>main.cpp
#include <iostream>

int main()
{
int x;
std::cin >> x;
std::cout << factorial(x);
}

>factorial.cpp
int factorial(int x)
{
if (x == 0)
return 1;
else
return x * factorial(x - 1);
}


Each .cpp is compiled to a separate .o (object code) file, with zero awareness of the other .cpp files also being compiled.
In this case, main.cpp won't compile, because you're using a function that hasn't been declared (factorial). What you have to do is add a prototype for the factorial function.
>main.cpp
#include <iostream>

int factorial(int);

int main()
{
int x;
std::cin >> x;
std::cout << factorial(x);
}

The function prototype is effectively a note to the compiler that says "you will have to find the implementation of this elsewhere, but this is how you use it".
A header file will typically contain all the declarations for its corresponding .cpp. So rather than writing declarations for all the functions you want to get from another .cpp, you just #include the header.

The final step after compilation is linking. After all the object files have been compiled, the linker must piece the object files together and replace all the stubs with calls to the functions from other object files.
>>
>>62360665
I was recently going over some old code I wrote in uni, and I came across a usage of vector<bool>. It was plastered with warnings to see the docs before touching the code. Fucking C++. I'm glad I dumped it for less esoteric languages.
>>
>>62361456
this
Qt is the best way to get GUI (cross platform) and it's pretty tough, you have an entire set of classes that replace the standard classes, instead of std::string you have QString, etc...
Thread posts: 29
Thread images: 2


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