Author Topic: best program to learn C++?  (Read 14759 times)

0 Members and 1 Guest are viewing this topic.

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
best program to learn C++?
« on: June 09, 2008, 06:18:02 PM »
Hello, I've got alot of experience programming robots using BASIC but I want to learn C++.  Not just for robots, but to make a simple program.  Does anyone have any suggestions what compiling program to get for noobs? :P

Bane

Offline Yakri

  • Beginner
  • *
  • Posts: 1
  • Helpful? 0
Re: best program to learn C++?
« Reply #1 on: June 09, 2008, 09:50:31 PM »
I use Bloodshed Dev-C++ and it works great for me, although I am still a total noobie at it. That should work fine for windows, but if your running a *nix operating system or a mac OS then i think you will need a different one.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,150
  • Helpful? 109
Re: best program to learn C++?
« Reply #2 on: June 10, 2008, 01:07:51 PM »
The standard AVR tools contain a C++ compiler as well as the C compiler. See my posting in the member forums for a C++ library to help you out. But if you need to learn C++ from scratch then consult Google, books etc etc.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline krich

  • Robot Overlord
  • ****
  • Posts: 165
  • Helpful? 0
Re: best program to learn C++?
« Reply #3 on: June 11, 2008, 10:51:22 AM »
Probably one of the best ways to learn C++ is on a Linux/Unix system at the command prompt.  If you have a Linux/Unix system handy, you can get quite far with very little effort.  Unless you're familiar with Linux/Unix, building a system just to learn C++ is probably not the best use of your time.

For the Windows oriented person, Microsoft has free versions of their Visual Studio languages, C++ is here.  Its adherence to the C++ standards and standard libraries is at times questionable, but for your purposes it'll do just fine.  Just realize when you move from a PC to an MCU like the AVR series, that Microsoft uses a superset of the standard C++ libraries, and WinAVR, because of memory and processor constraints, uses a subset of the standard C++ libraries.  Not everything you can do on a PC is going to work on an AVR.

I find programming MCUs much more difficult because you constantly have to be aware of the data space usage, program size, and algorithm optimization.  All of those concerns/pitfalls make it huge effort to spit out your first "blink" program if you're still struggling with the language.  For that reason, it might be better to learn C++ on a PC first, then jump into MCU programming.  Hopefully by then WinAVR will properly support C++.

Also, as Webbot suggested, get a book.  A good one.  Something you can use as a reference.  It's been years since I bought a book on C++, but the one I bought and learned from is "The C++ Programming Language" by Bjarne Stroustrup.  Not sure its even still in print, or if the C++ standards have deprecated its contents.

(haha...cool...I just pulled the book off my shelf and I must have been using the original receipt as a bookmark.  It was purchased on 6/26/1989 at 4:53pm for $33.75.  How it stayed in the book for that long with that much use, I have no idea.)

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: best program to learn C++?
« Reply #4 on: June 11, 2008, 02:51:36 PM »
Quote
For the Windows oriented person, Microsoft has free versions of their Visual Studio languages, C++ is here.  Its adherence to the C++ standards and standard libraries is at times questionable, but for your purposes it'll do just fine.
  Thanks, thats more of what i'm looking for.  (2 hr and 36min to download though :P :P :P, time to take a nap :D)

Quote
haha...cool...I just pulled the book off my shelf and I must have been using the original receipt as a bookmark.  It was purchased on 6/26/1989 at 4:53pm for $33.75.  How it stayed in the book for that long with that much use, I have no idea.)
  lol

I first want to make simple logic programs on my PC for starters, because i might have to program a PLC for a machine at work.  However, I'd like to also program robots later in C++ rather than BASIC

Bane
« Last Edit: June 11, 2008, 02:53:15 PM by BANE »

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: best program to learn C++?
« Reply #5 on: June 11, 2008, 03:10:37 PM »
what about this one http://www.creationengine.com/html/p.lasso?p=14332   Pretty cheap to me and I qualify as a student.
Bane

Offline dolinay

  • Contest Winner
  • Jr. Member
  • ****
  • Posts: 18
  • Helpful? 0
Re: best program to learn C++?
« Reply #6 on: June 12, 2008, 08:30:39 AM »
Hi,
I don't think you need to buy VS Studio Pro just to learn C++. You will not be able to write programs for robots in VS - at least not for the cheap ones which use microcontrollers, such as Atmel or PIC.  To learn C++ the free (Express) edition of Visual C++ will do fine. Even better, I'd first buy a book or find a good tutorial on the internet and then use the program which my learning text uses. The book may even include CD with Visual C++ or other development environment, so no need to download for 3 hours ;) 

Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,430
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
Re: best program to learn C++?
« Reply #7 on: June 12, 2008, 10:48:26 AM »
from the few C++ courses i've taken in college...the textbooks always come with the same free IDE called MetroWorks CodeWarrior.

Offline dolinay

  • Contest Winner
  • Jr. Member
  • ****
  • Posts: 18
  • Helpful? 0
Re: best program to learn C++?
« Reply #8 on: June 12, 2008, 12:17:06 PM »
I know Code Warrior from programing Freescale microcontrollers HC08. There are versions of this IDE which can compile code for many microcontrollers, DSPs and I guess also for Windows which you used in your courses. For a start you should probably write simple Win32 "Console applications" - that's exe file which displays black command prompt window when you start it- In this type of program you can easily output results from your programu using "printf" or "cout". Don't get into any GUI stuff if you intend to use C++ for programming microcontrollers, you will not need it and it's too complex.
The advantage of Code Warrior is that you could stick with the same environment when moving from Windows programs to microcontroller, but MS Visual Studio is much nicer to work with - I'd say it's the standard of development IDE, the other IDEs are something like a year or 2 behing it... I know some people will disagree  :)

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: best program to learn C++?
« Reply #9 on: June 12, 2008, 07:19:50 PM »
Thanks for the posts guys :).  I think buying a book for starters with a CD is probably my best bet.  Any idea what type and where to buy a good one (preferabley at a well-known books store or something ;))  I've googled it and i get a lot, theres got to be one thats the best ;D)

Bane

Offline krich

  • Robot Overlord
  • ****
  • Posts: 165
  • Helpful? 0
Re: best program to learn C++?
« Reply #10 on: June 12, 2008, 10:42:20 PM »
For a start you should probably write simple Win32 "Console applications" - that's exe file which displays black command prompt window when you start it- In this type of program you can easily output results from your programu using "printf" or "cout". Don't get into any GUI stuff if you intend to use C++ for programming microcontrollers, you will not need it and it's too complex.

Good point dolinay.  I was heading back to this thread to say this exact thing.  Stay with Win32 console apps because that's more like what the MCU programming environment is like.

Later.

Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,430
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
Re: best program to learn C++?
« Reply #11 on: June 13, 2008, 09:51:03 AM »
I was using a book called "Big C++"

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: best program to learn C++?
« Reply #12 on: June 13, 2008, 05:00:19 PM »
Ok Ive just download Dev-C++ and I'm trying out a program that can take the average of three numbers.  However, I just noticed something when i had compiling errors on a code thats i saw work on You-tube.  And then i happened, i have Vista on my laptop and the requirments didn't say if they support it.   :-[
Any body have any trouble with vista or even try it?

Bane

Offline emmannuel

  • Full Member
  • ***
  • Posts: 87
  • Helpful? 0
Re: best program to learn C++?
« Reply #13 on: June 13, 2008, 05:16:20 PM »
Ok Ive just download Dev-C++ and I'm trying out a program that can take the average of three numbers.  However, I just noticed something when i had compiling errors on a code thats i saw work on You-tube.  And then i happened, i have Vista on my laptop and the requirments didn't say if they support it.   :-[
Any body have any trouble with vista or even try it?

Bane

I don't know anything to help you there but all I can say is C/C++ can be tough to learn.  Seriously start out with a simple "hello world" C program see if you still get your errors.  It might be just things in the compiler that needs to be configured properly.

I would recommend starting off slow learn C basics.  Loops will be similar to stuff you've done in Basic.  Learn how C works, syntax, logic, functions.  That alone will help you quite a bit.  There are more things like structs and pointers that you want to learn but aren't 100% necessary from what I've played around with in microcontrollers.  C++ just builds on C and takes things to a whole new level and a slightly different way of thinking.

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: best program to learn C++?
« Reply #14 on: June 13, 2008, 06:32:04 PM »
Quote
just things in the compiler that needs to be configured properly.
Do you mean that you have to tell the compiler what to recognize???

Bane

Offline emmannuel

  • Full Member
  • ***
  • Posts: 87
  • Helpful? 0
Re: best program to learn C++?
« Reply #15 on: June 13, 2008, 06:41:13 PM »
Quote
just things in the compiler that needs to be configured properly.
Do you mean that you have to tell the compiler what to recognize???

Bane

Sorta, there are ton of settings and I've never used that compiler.  Some of the settings involve telling to tell the compiler where to set the displaying of warnings/levels at.  It might be compiling just fine and its just shooting a ton of warnings flags.

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: best program to learn C++?
« Reply #16 on: June 13, 2008, 06:48:28 PM »
Oh, figure out whats wrong with my code.  Had ( ) around the main program instead of { }, big difference :P

Bane

Offline emmannuel

  • Full Member
  • ***
  • Posts: 87
  • Helpful? 0
Re: best program to learn C++?
« Reply #17 on: June 13, 2008, 07:10:28 PM »
Oh, figure out whats wrong with my code.  Had ( ) around the main program instead of { }, big difference :P

Bane

Welcome to C programming :D

I hope you always kept the same case for your variable names.  Thats and many other things you'll realize Basic let you get away with, that other languages won't.

Offline Rand alThor

  • Full Member
  • ***
  • Posts: 83
  • Helpful? 0
  • Lord Tristan the Dragon Slayer
Re: best program to learn C++?
« Reply #18 on: June 15, 2008, 03:53:50 PM »
I don't know about the rest of you guys, but I'm a veteran programmer, especially in C++, and I think the best way to learn C++ is to pick up a copy of Beginning Programming for Dummies. It's how I learned (programming in general and C++). I don't recommend getting C++ for dummies because the book is harder to understand and most of it is covered in Beginning Programming for dummies.

Offline izua

  • Supreme Robot
  • *****
  • Posts: 682
  • Helpful? 0
Re: best program to learn C++?
« Reply #19 on: June 16, 2008, 07:56:24 AM »
devC++ sucks, IMO. no code folding, poor unicode support, ugly IDE, little flexibility with project files.
a bit better is wxdevC++, which has the unicode and project files issues addressed (plus a RAD tool for wxWidgets).

I use code::blocks, which is all i want. it has mingw with it, and i found a distro that included avrgcc.
it has an avr project template if you really want it, so you can compile and manage both your pc software and your avr software from the same IDE.
Check out my homepage for in depth tutorials on microcontrollers and electronics.

Offline benji

  • Supreme Robot
  • *****
  • Posts: 832
  • Helpful? 0
Re: best program to learn C++?
« Reply #20 on: June 16, 2008, 03:02:26 PM »
i did buy (C++ a beginners guide by Mcraw hill)
its a good start
good ol' BeNNy

Offline izua

  • Supreme Robot
  • *****
  • Posts: 682
  • Helpful? 0
Re: best program to learn C++?
« Reply #21 on: June 16, 2008, 07:43:00 PM »
the best way to learn C++ is to look over other people's code (after you learn the basics like structures, keywords, etc). Really. try www.pscode.com for tons of C/C++ code.
Check out my homepage for in depth tutorials on microcontrollers and electronics.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,150
  • Helpful? 109
Re: best program to learn C++?
« Reply #22 on: June 17, 2008, 12:31:38 PM »
Or download my C++ libraries from the Members Tutorials....... plug.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: best program to learn C++?
« Reply #23 on: June 18, 2008, 04:07:45 PM »
I was just thinking about making a C++ program that can factor a polynomial.  I was thinking i might actually pretty easy.......maybe :o.  I  could use the quadratic formula and hopefully be able to even get imaginary answers out of it.  Sound pretty cool?

Any idea how to enter the ax^2+bx+c without entering it in a different line every time?

Bane

Offline emmannuel

  • Full Member
  • ***
  • Posts: 87
  • Helpful? 0
Re: best program to learn C++?
« Reply #24 on: June 18, 2008, 07:43:46 PM »
I was just thinking about making a C++ program that can factor a polynomial.  I was thinking i might actually pretty easy.......maybe :o.  I  could use the quadratic formula and hopefully be able to even get imaginary answers out of it.  Sound pretty cool?

Any idea how to enter the ax^2+bx+c without entering it in a different line every time?

Bane

Use the plus sign as the delimiter, and parse out the tokens.

Offline emmannuel

  • Full Member
  • ***
  • Posts: 87
  • Helpful? 0
Re: best program to learn C++?
« Reply #25 on: June 18, 2008, 07:54:44 PM »
Use the plus sign as the delimiter, and parse out the tokens.

Sorry if I wasn't very clear.

You can do a for loop into the char array to find out if you have a plus sign. Note that location.
So from the beginning of the array (0) to that delimiter location (4) minus one you have one token. (ax^2)

Using that found plus sign location you loop through the array again looking for the next plus sign.
From the first plus sign (4) plus one, to the last plus sign (7) minus one you have the next token.  (bx)

From the last plus sign loop to find NULL.
From the second plus sign (7) plus one, to the NULL (9) minus one you have the last token. (c)

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: best program to learn C++?
« Reply #26 on: June 22, 2008, 05:38:07 PM »
I learned C++ using CodeWarrior . . . it was the default IDE that CMU used to teach programming before they converted to Java . . .

I learned by taking classes and reading the textbook . . .

Offline mangoraisin

  • Beginner
  • *
  • Posts: 4
  • Helpful? 0
Re: best program to learn C++?
« Reply #27 on: June 29, 2008, 02:24:51 AM »
I use Bloodhsed -dev c++, and the gcc compiler,

BUT, use 'C',   'C' is a great language, a powergul language, a popular language.

C++, is a whole bunch of messy object oriented stuff added on top of C.

If you want to do go to big non-embedded applications, use Java, or C#

Both of these languages are so reliable and elegant they make C++ look like a messy bunch of crap, (not to be confused with 'c', which is great)

So to conlcude:

'C' good, low level, elegant, and popular

C# easy, powerful, reliable and popular

Java, easy, powerful, reliable and cross platform

C++ an obsolete and unreliable language.







Offline izua

  • Supreme Robot
  • *****
  • Posts: 682
  • Helpful? 0
Re: best program to learn C++?
« Reply #28 on: June 29, 2008, 04:09:10 AM »
C++ an obsolete and unreliable language.


exactly. C++ is crap. that's why it is the choice of major game design companies and the assumed language in almost any openGL tutorial, the language in which the php interpreter is programmed, the language on which most linux distros and the attached software comes programmed in. A
not to mention, most of the pseudocode out there follows a C++ structure (curly braces, pointer and object operators :P).

So, I guess that so many people use it just because they think it's good. They're wrong. Use Visual Basic. 3, if possible. If not, 2, or Qbasic. That's what Torvalds used to write its kernel.

I'd sugest you learn brainfuck or lolcode
Check out my homepage for in depth tutorials on microcontrollers and electronics.

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: best program to learn C++?
« Reply #29 on: June 29, 2008, 05:53:20 AM »
Thanks, I think I'm going to get Brainf*ck and Lolcode both and try to learn them both while doing your mom..................... :D :D :D

No, not really, I have already downloaded BloodShed and seem to like well.

But thanks for all the helpful posts though ::)

Defiantly not Bane
« Last Edit: June 29, 2008, 05:56:03 AM by BANE »

 


Get Your Ad Here