Newbie programmer needs advice

F

FieldDoc

Guest
Hi,

I have been programming PCs as a hobby for a few years - nothing more adventurous than BASIC and VB. I have recently purchased a Mac. I would like to learn a language like C or C++ (I don't know the difference) and would like to know how to go about this. I have installed the Xcode development suite that I found on my HDD (I have OS X10.3) but I do not know if this can be used to write C/C++ programs. Can anybody offer me advice as to the difference between C/C++ and how I can go about coding in them.

Many thanks,
 
OP
W

WilliS

Guest
make a C++ project... and start with this:

#include <iostream.h>

int main (void)
{

//code goes here

return 0;
}




probably want to pick up a book on basic commands in c++ or c (i dont know c but i dont think its much different)

start with stuff like cout << "Hello World";
you can initialize variables using: int / float / double / long / char.. they are pretty self explanitory

looking at code helps learn too...

cin / cout are the common ways to accept data, and display data

int ageVariable = 0;

cout << "Enter your age: " << endl;
cin >> ageVariable;

cout << "You are " << ageVariable << "years old" << endl;

endl = return after text

not sure what you're looking to learn.. those are some very basic commands... try getting a book...or maybe reading tutorials online


goodluck
 
OP
Z

Zach_C

Guest
A book would be the best way in my opinion. C++ for dummies worked well for me I have heard a lot of good things about Sams C++ in 21 days.

If you already know a language like BASIC I would venture towards C++. It explains the aspects of Object oriented programming which is very important.

Good Luck, and welcome to the Mac. I made the switch about 6 months ago and my programming hobby turned into an addiction with unix and project builder.
 
Joined
Mar 9, 2004
Messages
2,860
Reaction score
21
Points
38
Location
Miami FL
Your Mac's Specs
G4 1Ghz OS X 10.4.7
C is sort of the original, and I hear it's good to learn C first. C++ is the newer, turbo I guess, with more bells and toys. :p
 
Joined
Nov 4, 2003
Messages
654
Reaction score
11
Points
18
Location
Southern Indiana
Your Mac's Specs
Mac Pro Quad Xeon 2.66GHz 3GB RAM, G4 Quicksilver w/Sonnet 1GHz Encore ST, 1ghz G4 Powerbook
OP
D

dr_springfield

Guest
Well, C++ is C, only with more object oriented bells and whistles. If you want to learn to program on the mac, you could start off as DualG5Lova recommended, learning ANSI C++, which is entirely terminal based. But you seem to want to learn how to program on the mac, and so I recommend learning Cocoa or Carbon. Since you don't know C++ at all, I recommend learning Cocoa. Developing on a mac with Cocoa is very straightforward, especially if you're learning from a book like O'Reilly's Learning Cocoa (http://www.oreilly.com/catalog/learncocoa/). There's also a newer edition http://www.oreilly.com/catalog/learncocoa2/. These books will give you a quick and dirty introduction to practical coding on the mac, and tons of examples for a beginner, without all the added baggage that a learning C++ book will teach you, and you will never ever use in your lifetime.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top