Where to start programming

Associate
OP
Joined
16 Nov 2011
Posts
1,526
Location
Nottingham
I disagree. It's perfectly feasible to learn C++ first. Also make sure to get the C++11 edition of those books (or any other C++ book...)

The only book I've seen recommended for learning C++ by almost everybody seems to be the C++ Primer book; and people have said that is the best introductory book, whilst others (even in this thread) have said that it isn't good for an introduction, and requires good knowledge before people would recommend buying it. The thing is, the only other book I've seen recommended is the 'C++ in easy steps', which is cheap, and short. I suppose I could get both of them if the short ones gives me a firm grasp on the language. I still have plenty of time to decide what to do though, I don't actually plan on starting to program until after Christmas so we'll see.
 
Associate
Joined
9 Sep 2008
Posts
424
Location
York
I disagree. It's perfectly feasible to learn C++ first.

It depends who you are. I would recommend learning C++ first to a mathematician, for example. I would hesitate before recommending it to the general learner as it is such a complex language. One can now shoot ones-self in the foot with it in even more ways with C++11.

Also make sure to get the C++11 edition of those books (or any other C++ book...)

Excellent advice. C++11 marks a significant improvement on the previous version (even if you can shoot yourself in the foot in even more ways than before...)
 
Associate
OP
Joined
16 Nov 2011
Posts
1,526
Location
Nottingham
Hi again
Not sure if I'm allowed to bump this but I'm going to take the risk anyway :o

I've finally started to program, just today actually. Had some work to do in time for Christmas for college, probably should have started earlier but I'm going to stick to it now!
I got four books for Christmas as a kind of "long term investment"; which were: Python for the absolute beginner, Head first Java, C++ in easy steps, and C++ Primer. I've started on the Python book and I'm absolutely loving it. I'm going to finish this book first, and then move onto the next (whether that be Java or C++, I'm not entirely sure yet.)
I feel I've got a good grasp already on functions (although I'm yet to use more than the print/input function), arguments, and all of the "basic, beginner" terminology and I'm actually having a lot of fun experimenting; I had quite a few errors with the program I made such as missing out the bracket at the end of a function but I fixed them all.

Obviously I'm mainly focusing on Python at this point since I've been told numerous times throughout this thread that it's the perfect introductory language to OO-languages.
Is there a huge difference in terms of difficulty and complexity between Python and C++? Just a minor concern, but not too worried yet!
 
Associate
Joined
10 Nov 2013
Posts
1,804
I realise I'm not answering your question but if I were you I wouldn't even bother looking at the Java/c++ books until you've spent a lot of time with python. The different syntax/keywords/etc will only confuse matters until you have a firm grasp of the key concepts.

I would suggest going through some more online tasks/tutorials for python, maybe set yourself a project you can work towards.

Once you are comfortable with python and oop, I don't think you would find c++ particularly difficult - the more you code, the easier it is to pick up other languages.
 
Last edited:
Associate
OP
Joined
16 Nov 2011
Posts
1,526
Location
Nottingham
I realise I'm not answering your question but if I were you I wouldn't even bother looking at the Java/c++ books until you've spent a lot of time with python. The different syntax/keywords/etc will only confuse matters until you have a firm grasp of the key concepts.

I would suggest going through some more online tasks/tutorials for python, maybe set yourself a project you can work towards.

Once you are comfortable with python and oop, I don't think you would find c++ particularly difficult - the more you code, the easier it is to pick up other languages.

Yeah like I said, I'm going to continue doing this book until I finish it. The good thing about this book is that at the end of each chapter, the author has set the reader challenges to make their own programs based upon the factors learnt within that chapter, which means I'm not directly copying from the book, and then I can make some more of my own programs based upon those.
Thanks for the advice though!
 
Associate
OP
Joined
16 Nov 2011
Posts
1,526
Location
Nottingham
Here's practically the second program I've ever made and it's based upon User Input. I just threw some random questions together to see what I could do. Would appreciate some feedback as to what I could improve on (i.e if there are any short cuts I didn't take advantage of). I pretty much used my own logic to determine how to approach questions with 'if' and 'else', even if it is beginner stuff.

I was also wondering if there were any websites with complete dictionaries of the terminology, it all gets a little confusing sometimes already since there's so many literal terms for things.

Code:
# User Input

print("-" * 80)
print("-" * 34 , "!User Input!" , "-" * 34)
print("-" * 34 , "!By Daniel James!" , "-" * 29)
print("-" * 80)

ready = input("Are you ready?: ")
if ready == "yes" or "YES":
    print("Prepare yourself for the mission that determines " \
          + "whether or not you are worthy. " + "COME WITH ME IF YOU " \
          + "WANT TO LIVEEE!!")
    name = input("\nHello there friend, what's your name? ")
    print(name)
    print("Hi, ", name)
    age = input("\nHow old are you, young padawan? ")
    age = int(age)
    print(age)
    print(age , "huh? I definitely think you shall suffice, squire!")
    attention = ("This service requires your utmost attention. " \
                 + "So pay CLOSE scrutiny.")
    print(attention)
    weight = input("\nHow much do you weigh in pounds?")
    weight = int(weight)
    print(weight)
    weight_jupiter = weight * 2.54
    weight_saturn = weight * 1.08
    weight_uranus = weight * 0.91
    weight_neptune = weight * 1.19
    weight_pluto = weight * 0.06
    weight_moon = weight * 0.17
    weight_venus = weight * 0.91
    weight_mercury = weight * 0.38
    weight_mars = weight * 0.38
    print("On Jupiter, you'd weigh " , weight_jupiter , "pounds.")
    print("On Saturn, you'd weigh " , weight_saturn , "pounds")
    print("On Uranus, you'd weigh " , weight_uranus , "pounds")
    print("On Neptune, you'd weigh " , weight_neptune , "pounds")
    print("On Pluto, you'd weigh " , weight_pluto , "pounds")
    print("On the Moon, you'd weigh " , weight_moon , "pounds")
    print("On Venus, you'd weigh " , weight_venus , "pounds")
    print("On Mercury, you'd weigh " , weight_mercury , "pounds")
    print("On Mars, you'd weigh " , weight_mars , "pounds")
    print("That's a lot of information to take in! Henceforth we " \
          + "shall resume the preparation of our mission in the near " \
          + "future!. See you soon, marine.")
    
    
    
    

    

else:
    print("God damn you little wretch, wasting my time." \
          + "I don't have time for scum like you.")

          

          
input("\n\nPress the enter key to exit.")
 
Last edited:
Soldato
Joined
6 Mar 2008
Posts
10,078
Location
Stoke area
dee, use code tags :) that's a nightmare to read :p

also, some people might put y/Y for yes :D

I'll have a look for some compiling solutions for you. They do all seem to be broken though or have some major issues. :(
 
Last edited:
Associate
OP
Joined
16 Nov 2011
Posts
1,526
Location
Nottingham
dee, use code tags :) that's a nightmare to read :p

also, some people might put y/Y for yes :D

I'll have a look for some compiling solutions for you. They do all seem to be broken though or have some major issues. :(

Sorry! It was a quick post so didn't see the option there; edited it now. I've tried loads of different ways from an array of different tutorials on compiling .py files into .exe but none of them seem to work :( It's not mandatory, I'd just like to be able to send some friends a program when I make one for them to test it out. I also was going to but a few more options for 'yes' but since I'm the only one using these programs at the mo I knew what I would be entering :p

As a simple extension dee you could look at using a basic array to store the weight factors and use those for the outputs.
Ah. I knew there'd be a way around typing them all out. How would I go about this? I'm only up to chapter 3 in the book so I'm sure I'll find out soon enough.

I think the main thing is that I'm really enjoying it so far, and if I stick to it I'm sure I'll be able to become competent, and then develop further into C++ hopefully!! The one factor I've found the most fun is finding and fixing syntax errors within a program, even if it is only something like a bracket or a double quote.
 
Last edited:
Soldato
Joined
6 Mar 2008
Posts
10,078
Location
Stoke area
Ah. I knew there'd be a way around typing them all out. How would I go about this? I'm only up to chapter 3 in the book so I'm sure I'll find out soon enough.

I need to find a way of exporting to exe too so i'll be playing around over the next month trying to find a way :) I'll let you know if I do.


As for the array, in python it would be called a dictionary. I'm pretty new to Python myself, working through codeacademy and a few books but it'd be something like this:

Code:
weight = "user input"
weight_dic = { 'Jupiter': 2.54, 'Saturn': 1.08, 'Uranus': 0.91, 'Neptune': 1.19, 'Pluto' : 0.06, 'the Moon': 0.17, 'Venus': 0.91, 'Mercury': 0.38, 'Mars': 0.38}

for key, value in weight_dic.items():
    print ("On " + key + ", you'd weigh " + str(weight * value) + "pounds.")

for Python 3


The for loop just cycles through the dictionary (weight_dic) line by line and prints out the set string + the 2 bits of info (the key and value).

Might be an even better way of doing it, not sure but I'm sure a more experienced programmer can help :)

Edit: I'd be much better at this if I could put as much effort into learn as I do into solving/looking in to things like this :p lol
 
Last edited:
Associate
OP
Joined
16 Nov 2011
Posts
1,526
Location
Nottingham
I need to find a way of exporting to exe too so i'll be playing around over the next month trying to find a way :) I'll let you know if I do.


As for the array, in python it would be called a dictionary. I'm pretty new to Python myself, working through codeacademy and a few books but it'd be something like this:

Code:
weight = "user input"
weight_dic = { 'Jupiter': 2.54, 'Saturn': 1.08, 'Uranus': 0.91, 'Neptune': 1.19, 'Pluto' : 0.06, 'the Moon': 0.17, 'Venus': 0.91, 'Mercury': 0.38, 'Mars': 0.38}

for key, value in weight_dic.items():
    print ("On " + key + ", you'd weigh " + str(weight * value) + "pounds.")

for Python 3


The for loop just cycles through the dictionary (weight_dic) line by line and prints out the set string + the 2 bits of info (the key and value).

Might be an even better way of doing it, not sure but I'm sure a more experienced programmer can help :)

Edit: I'd be much better at this if I could put as much effort into learn as I do into solving/looking in to things like this :p lol
I see. So I'm basically creating my own dictionary within the program, that's pretty epic, I'm sure I'll learn it at some point in the book; I don't want to get writing loads of lines of codes that I have no idea what their function is, but I do get that. I'll probably look at creating a proper trivia questionnaire at some point, the next chapter in the book deals with the 'while' function so I could use that to loop people back to the question to try again if they get it wrong, say if I'm doing a multiple option question.
I'll also keep my eyes peeled for an exe compiler, it certainly would be very helpful :D
 
Back
Top Bottom