Posted: Fri Sep 24, 2004 2:16 pm Post subject: Where do i start?
I am starting C++, what would be the best place to start (code wise). Some of you might remember me from the Turing section, so i have some background in that and some java, although not extensive, i do know syntax and whatnot, and i hear C++ and java are similar in those respects. Anyway, is it better to start with pure syntax or just try to create from what i already know? please suggest
- Compwiz
Sponsor Sponsor
Andy
Posted: Fri Sep 24, 2004 2:30 pm Post subject: (No subject)
for noobies, i suggest VC6... it does lack stability and consistancy, but it'll work... start by remaking the old progs u did in other languages in c++, just dont do any graphics cuz then u'd have to use MFC/Direct X/OGL and all three are quite painful for starters
wtd
Posted: Fri Sep 24, 2004 3:01 pm Post subject: (No subject)
Absolutely not!
Visual C++ 6 is one of the worst C++ compilers available in terms of standards compliance. There's nothing worse for a student than being shown valid code and getting errors when compiling it.
GCC is available free and does a far better job than VC++6.
As for "Where to start?"...
I would start with basic concepts and then apply syntax to them.
Do you understand:
... the purpose of main?
... how to use includes and what they do?
... how to declare variables and assign values to them?
... how to create functions and procedures?
... the difference between a function and a procedure?
... how to specify that a function or procedure has a parameter?
... how to specify that a parameter is a reference?
... why you would pass an argument into a function or procedure as a reference?
... how to pass an argument or arguments to a function or procedure?
... why you should use functions and procedures liberally?
... why this is better than using global variables?
... how to create forward declarations of functions and procedures?
... why and when you should do this?
... integer arithmetic: why 3 / 2 = 1?
... how to read data in from standard input?
... how to write data to standard output?
... what a pointer is?
... how to create a new pointer variable?
... how to get a pointer to an existing variable?
... that a pointer is just a variable storing the location in memory of another variable?
... that pointers allow for dynamically allocated, rather than statically allocated memory?
... why this is important?
... how to allocate memory for a pointer?
... how to free that memory later on?
... how to declare an array?
... that an array stores several values of the same type?
... that the name of an array is just a pointer referring to the first value in the array?
... that, as a result, arrays can either be statically or dynamically sized?
... that it's possible to create custom data structures which combine multiple pieces of data into a single "thing"?
... how to declare a struct?
... that doing so adds a type to the system?
... how to create a variable of that type?
... how to access the individual components of a struct?
... that it's possible to put more than just data in a struct?
... that such data structures are called classes?
... that access to the things in a struct or class can be modified?
... that the only difference between structs and classes (in C++) is that everything in a struct is public by default, while everything in a class is private by default?
More to follow.
Mazer
Posted: Fri Sep 24, 2004 8:43 pm Post subject: (No subject)
For just starting, you'd probably want an IDE to work with. Dev-C++ is pretty nice, and it saves you the trouble of buying/pirating MSVC++. And I believe it is possible to have it compile your programs with gcc (somebody please correct me if I'm wrong).
omni
Posted: Fri Sep 24, 2004 8:45 pm Post subject: (No subject)
wow i understand 70-80% of that list. I feel like I'm making progress.
rizzix
Posted: Fri Sep 24, 2004 8:53 pm Post subject: (No subject)
aha i just tried this out just 2 days ago and now its the only one i use (if i use an ide i.e): CBuilderX by Borland.. it comes with two choices for a compiler: borland's own and GNU's
imho Dev-C++ is a buggy ide.. not stable at all.. i know its a work in progress and it has some cool features and stuff but its just not good enough for me. so i've decided to stick to CBuilderX. its pretty good.. and very much similar to their JBuilder IDE.
but if ur really into c++ development and you know how to write your own makefiles.. then u should try out Eclipse with the CDT plugin
wtd
Posted: Fri Sep 24, 2004 9:06 pm Post subject: (No subject)
Those new to programming would be best advised to avoid IDEs entirely for awhile. They tend to make things seem more complicated than they are, they make it difficult later on to distinguish features of the IDEand the language, and the command-line skills are good to have.
wtd
Posted: Fri Sep 24, 2004 9:51 pm Post subject: (No subject)
omni wrote:
wow i understand 70-80% of that list. I feel like I'm making progress.
I wasn't even remotely done.
Sponsor Sponsor
Mazer
Posted: Sat Sep 25, 2004 1:53 pm Post subject: (No subject)
rizzix wrote:
but if ur really into c++ development and you know how to write your own makefiles.. then u should try out Eclipse with the CDT plugin
Which reminds me... would anybody care to write up a tutorial on creating your own make files? I'll be needing that information in the near future and even now it'd be good to know.
compwiz333: sorry if I'm hijacking your thread with this
apomb
Posted: Sat Sep 25, 2004 3:00 pm Post subject: (No subject)
WOW... i almost dont have enough time right now to read all of this, but THANKS guys! i understand about 40% of what i read,which wasnt much right now, but i will definately look at all of that when i have time, anyway i cant believe all this help! Thank you, i will get started right away! i think i will take the advice of dodge and remake some of my turing text- based proggies. wtd: that was alot of info ... one big question that i have had since i heard of them are pointers ... what the **** are those!?
Oh ya and at my school, i think they have VC++6 too is this that terrible, im kinida getting mixed messages.... so borland at home tho ... right?
*going crazy from all the information*
Andy
Posted: Sun Sep 26, 2004 6:18 pm Post subject: (No subject)
w00t after u get the hang of it, learn getpixel
wtd
Posted: Sun Sep 26, 2004 9:57 pm Post subject: (No subject)
CompWiz333 wrote:
wtd: that was alot of info ...
You're welcome.
CompWiz333 wrote:
one big question that i have had since i heard of them are pointers ... what the **** are those!?
A pointer is a variable which stores the address of another variable, rather than the actual value of that variable.
CompWiz333 wrote:
Oh ya and at my school, i think they have VC++6 too is this that terrible, im kinida getting mixed messages.... so borland at home tho ... right?
*going crazy from all the information*
Yes, Visual C++ 6.0 is absolutely horrible. Borland is decent, from what I hear, but it's a fairly niche compiler. GCC (the GNU Compiler Collection, which includes g++, their C++ compiler) is your best bet. It's widely available on Unix, Linux, Windows, Mac, etc.
apomb
Posted: Sun Sep 26, 2004 11:25 pm Post subject: (No subject)
wtd wrote:
A pointer is a variable which stores the address of another variable, rather than the actual value of that variable.
oooh!!! thats kinda kool. i can get used to that!
started downloading the borland one ... first one i found! (finished tomorrow!) stupid 56k ... dont laugh, i offered to pay for highspeed but my parents are against the furthering of my knowledge haha
wtd
Posted: Mon Sep 27, 2004 3:17 am Post subject: (No subject)
CompWiz333 wrote:
wtd wrote:
A pointer is a variable which stores the address of another variable, rather than the actual value of that variable.
oooh!!! thats kinda kool. i can get used to that!
Yes. It makes certain interesting things possible. However, don't get too used to them. Pointers are powerful, but they're dangerous too. Understanding them is key to understanding C++, but that understanding includes knowing when not to use them.
A simple example:
code:
int i = 42;
Pretty standard stuff, right?
code:
int i = 42;
int * j;
Whoa! Hold the horses! What's that * doing in the middle of things?
That's the C++ (and C/Obj-C) way of declaring a pointer variable. But right now it's npt pointing to anything in particular, which in C and C++ terms means it could be pointing to any random thing. Can't overstate how dangerous this is.
code:
int i = 42;
int * j = &i;
Much better. We've initialized the pointer with the address of i. The & is the "address of" operator. Read that line as "integer pointer j is address of i."
code:
int i = 42;
int * j = &i;
std::cout << j << std::endl;
Wait a second, why don't I see 42 on the screen?
This is because j is just storing the location in memory of i. What you're seeing is that address. It's basically just another int.
code:
int i = 42;
int * j = &i;
std::cout << *j << std::endl;
Ah, much better. I've used the * operator to "dereference" the pointer, getting at the variable it's actually pointing to.
Mazer
Posted: Mon Sep 27, 2004 7:32 am Post subject: (No subject)