Thread: I'm a total begginer

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    8

    Question I'm a total begginer

    So here I am, just decided to learn C++ .
    I've got a few questions:
    1. When is it better to use a class and when a structure?
    2. What's a double (like when you put int, char, etc.)?
    3. With what project should I start...
    4. What are binary trees and what uses they have?


    If you're wondering my only trainig on C++ are the tutorials in cprogramming.com, until binary trees, wich I didn't understood...

    Thanks for helping a newcomer,
    Me

  2. #2
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    I'm pretty certain structures aren't standard C++, in fact I'll check that one myself.

    double precision number. More precison than float, but takes up a bit more memory.

    Hmm a first project? Whatever takes your fancy really. Just do anything in the area you're interested in so you can start expanding your knowledge ASAP.

    Prelude has a great section on binary trees, check her website:

    http://www.eternallyconfuzzled.com/tuts/bst1.html
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  3. #3
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    Posts
    483
    if you are a total begginer i suggest you start right from the begining those things will come along as you learn.

    im not sure what structure is, i never use them. i use classes.
    When you start learning C++ youll see the different types (Long , short, int, double, float).

    YOU MUST START WITH "Hello World!", OR ELSE!!

    EDIT:
    You have read the tutorials on this site.. then i guess you are not a total beginer..

    Just use classes they are much easier to work with.
    Binary Trees are basicly Data Structures to store data, somewhat like an array except they store it in a weird way.. i was just trying to learn about them not too long ago.. but i gave up
    Last edited by mrafcho001; 07-17-2005 at 10:16 AM.

  4. #4
    Registered User
    Join Date
    Jul 2005
    Posts
    8
    No, I've already did a Hello world and some more difficult things, I mean what could I make as my first program (maybe I'm going too quickly) and structures are here http://www.cprogramming.com/tutorial/lesson7.html

    NOw you've got it!

  5. #5
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    1. A class and a structure are the same thing, except that in a struct, everything is public by default, while in a class, everything is private by default.
    2. A double is a floating point number with a certain number of digits of precision. For example, you can store 6.02214199 * 10^23 in a double, but you can only keep track of the first 14 or 15 digits or so. And you can store relatively small numbers, such as 1.602176462 * 10^-19. This is much like the way handheld calculators store numbers. Integer types, on the other hand, can only store integers, in some limited range. (Doubles have limits, too.)
    3. What project? Um, write an RPN calculator, maybe.

    4. There are many uses for binary trees. One of the more popular ones is Binary Search Trees. Now you get to be one of the first people to discover if Prelude's tutorials are any good; see http://eternallyconfuzzled.com/tuts/bst1.html.

    Binary trees pop up in other places, too, such as the 'heap' data structure (which makes it efficient to find the minimum element of a collection), and they can also be used for representing mathematical expressions (in a number of different ways). Many algorithms, such as Huffman encoding, use binary trees.

  6. #6
    Registered User
    Join Date
    Jun 2003
    Posts
    361
    1)
    In C++ the only difference between a struct and a class is the default access level, which is private for classes and public for structs.
    - http://en.wikipedia.org/wiki/Record_(computer_science)
    2)
    A double is a floating point variable with twice as much memory set aside for storing data.

    3)
    See mrafcho001's "Hello World!" comment

    4)
    See ahluka's comment about Prelude's site. However, you probably shouldn't be worrying about Binary Trees yet. Learn the basics first. Binary Trees will come up on their own when it's time to use them.
    Pentium 4 - 2.0GHz, 512MB RAM
    NVIDIA GeForce4 MX 440
    WinXP
    Visual Studio .Net 2003
    DX9 October 2004 Update (R.I.P. VC++ 6.0 Compatability)

  7. #7
    Registered User
    Join Date
    Jul 2005
    Posts
    8
    OK thanks, I think I'm done for now.
    [Opens BloodshedDev-C++ and starts making a calculator, because as he has posted, the Hello WOrld is made]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with day of the week program
    By Punkakitty in forum C++ Programming
    Replies: 10
    Last Post: 01-14-2009, 06:55 PM
  2. Replies: 8
    Last Post: 11-03-2008, 09:48 PM
  3. long problem
    By loko in forum C Programming
    Replies: 28
    Last Post: 07-22-2005, 09:38 AM
  4. Loops
    By Dt7 in forum C++ Programming
    Replies: 3
    Last Post: 10-23-2004, 06:11 PM
  5. Replies: 4
    Last Post: 04-22-2003, 12:52 PM