Thread: Newb help with basic If Statement

  1. #16
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    C++ is OOP-oriented:

    The idea with OOP is that you don't need to have access to or care about the code of an object.
    All you need is the interface of the object and to know how it works.

    About your analogy with the car: I think most people are satisfied with only knowing how to drive the car, and to be a car manufacturer you must first know how to drive a car.

    When the programmers learns about pointers, the knowlegde of char* will come too.

    And, I never said that char* wasn't C++.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  2. #17
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    Hear ye....hear ye...the debate about whether to start with the STL string class because of its ease of use and learning about the underlying mechanisms as they become necessary/relevant versus learning the underlying stuff first and building from there rages on. Of course, if your compiler isn't STL compliant, and many out there aren't, then you have to use the basic mechanisms (unless you import a third party version of STL).

    I apologize if:

    "...since char* is C and std::string is C++..."

    means char* is C++, too. To me the above quote implies char* is C and not C++.

    Bottom line, std::string will only work if your compiler is STL (and namespace) compliant. You can learn to use strings either bottom up or top down, whichever suits your fancy, and your compiler.

  3. #18
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Anyway, I strongly recommend using a compiler which supports STL. I know there are free, STL capable compilers for Windows and Linux and probably for many other operating systems.

    My experience tells me: Use STL as much as possible!.
    It is very optimized (at least in my compiler) and not much slower. It will also save you days or hours of headache when something isn't working properly.

    I'll gladly admit that it can be very educational to reinvent the wheel sometimes, though.

    (Edit: Yay, I'm a member!)
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  4. #19
    . Driveway's Avatar
    Join Date
    May 2002
    Posts
    469
    use stricmp() to compare regardless of case. Takes same parametrs and returns the same, just that case doesn't matter

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Usefulness of the "else if" statement
    By gn17 in forum C Programming
    Replies: 7
    Last Post: 08-12-2007, 05:19 AM
  2. Switch statement
    By beene in forum C++ Programming
    Replies: 21
    Last Post: 07-01-2007, 08:13 AM
  3. Extremely basic encryption program
    By CrackerJack in forum C Programming
    Replies: 15
    Last Post: 11-30-2003, 12:45 PM
  4. having trouble understanding this statement
    By kes103 in forum C++ Programming
    Replies: 2
    Last Post: 10-03-2003, 09:00 AM
  5. string & if statement
    By Curacao in forum C++ Programming
    Replies: 4
    Last Post: 05-02-2003, 09:56 PM