Thread: C or C++ for first language ?

  1. #31
    Registered User Mobidoy's Avatar
    Join Date
    May 2007
    Posts
    18
    Wow, i am amazed how my topic turned out. I wont say i dont like it. It gives me a lot of info, now i can make a good idea but, as i can see, not alot of ppl are talking about C#. As i said, this will only be an hobby for me. I hope some ppl will give there opinion about C Sharp cause, that is the path i took.

    I dont say that i will left C and C++ out, i will still (in couple of months/years) have a look to hem.

    Thanx all

  2. #32
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    Quote Originally Posted by swgh View Post
    But as David P pointed out once, there is no harm in learning both languages.
    I'd like to address this first. I agree whole heartedly with this sentiment. In fact, I'd encourage all coders to learn as many languages as you can. Even if you're not using the language on a day-to-day basis, you can sometimes apply techniques from one language to another. For instance, python 2.5 now has a form of RAII!

    Also, you can learn to program with almost any language. I started with basic as a kid, did my first "real" projects in C at uni and became (hopefully) proficient at C++ when I started work.

    But that wasn't the most efficient way to learn. IMO you will become a better programmer faster starting with python. Then if you want to learn C or C++, you can. and you can focus on the aspects of C/C++ that are different/more difficult than other languages, because you're not struggling with what a for/while loop is or how to write a function.

    That said, there is something to be said for doing things the hard way first. You don't really appreciate strings until you've spent at least 12 hours straight trying to debug a tricky char array problem!

    So while I think Python is a good starting language (and practically, good enough for 90% of your coding work) I don't believe you are a well-rounded programmer until you understand something about the lower levels. How low you go is up to you....

    Quote Originally Posted by swgh View Post
    Good points Chaos Engine, But I put this to you...

    Seasoned C programmers i have spoken to at college and university state that they would never revert to C++ as they are so used to how they code now. Even thiough they have glanced at C++, they know C "too well" to revet back for one reason:

    'It is too hards to break our habbits' Ie: #define for a constant instead of C++ const keyword.

    Do you agree with their statement or would you say to them C++ offers more to them than C?
    For some reason, that's a disease that afflicts C programmers in particular. Again it's all about productivity. In C++, there are very good reasons not to use #define instead of const, but if you try to torture C++ into being C you're missing out on the benefits of the language.

    For example, when I first started coding in python, I tried to get around the lack of static typing by testing the type of each parameter

    Code:
    def CreateAndShowWindow(wnd):
        if type(wnd) != ChaosWindow:
            raise hell
     
        # some code
    I quickly realised this was pointless (and extra work too!). The Python philosophy is fundamentally different from C++ in this regard, so I learned to switch my brain into python mode.

    So no, I don't agree with their statement. I currently work in C, C++ and python.
    The C work is on an embedded platform that doesn't have a C++ compiler and only has 64k of rom, so code size is important. This means doing things in C that I'd never do in C++, but when I switch back to C++, I use the correct C++ way of doing things (even if it's not as small or as efficient as the C way)
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  3. #33
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    Quote Originally Posted by Mobidoy View Post
    Wow, i am amazed how my topic turned out. I wont say i dont like it. It gives me a lot of info, now i can make a good idea but, as i can see, not alot of ppl are talking about C#. As i said, this will only be an hobby for me. I hope some ppl will give there opinion about C Sharp cause, that is the path i took.

    I dont say that i will left C and C++ out, i will still (in couple of months/years) have a look to hem.

    Thanx all
    C# is a good language to start with. It's pretty simple, has a relatively clean syntax and a powerful library to back it up.

    As long as you're comfortable being limited to windows (last time I check mono wasn't really there yet), go for it!

    Quote Originally Posted by swoopy View Post
    >but the c implementation is arbitrarily limited to 256 chars in a name.
    More like 255.

    I agree with your viewpoint on the topic though.
    exactly! see how easy it is to make a mistake?
    Last edited by ChaosEngine; 05-23-2007 at 04:50 PM.
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  4. #34
    Registered User
    Join Date
    May 2007
    Posts
    5

    Its up to you...

    According to me C++ is the best choice of programming language today. C is good but remember C++ is superior than C. C++ is same as C but with added features like OOP etc.
    But above all things its up to you which language you choose but if you sort it out to C and C++ then better choose C++.

    For more info you can visit my blogsite.
    I don't know whether its correct to post the link here but anyways, the link is

    http://learning-computer-programming.blogspot.com

  5. #35
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    Excellent answer. iI think you made some very valid points. But to be honest many of my friends who code in C are too "stubbon to change their ways and broaden their learning horizens.
    Double Helix STL

  6. #36
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Quote Originally Posted by arvind_gupta View Post
    According to me C++ is the best choice of programming language today. C is good but remember C++ is superior than C. C++ is same as C but with added features like OOP etc.
    But above all things its up to you which language you choose but if you sort it out to C and C++ then better choose C++.

    For more info you can visit my blogsite.
    I don't know whether its correct to post the link here but anyways, the link is

    http://learning-computer-programming.blogspot.com
    That's a pretty shallow statement, C has definitly proven itself over the last few decades. Sometimes C just 'fits' the job much nicer, consider the Linux kernel, C was chosen because the fears that a C++ compiler took much of the 'behind the scene' work away from the programmer, therefore taking control away from them). C has a place, but so does C++, So why not learn both?

  7. #37
    Registered User
    Join Date
    Jan 2007
    Posts
    330
    Quote Originally Posted by Mobidoy View Post
    As i said, this will only be an hobby for me. I hope some ppl will give there opinion about C Sharp cause, that is the path i took.
    It really boils down to what you mean with "only a hobby". If you wanna make funny games or simple windows application or something then C# can get you the quickly.
    If you like doing hacker kinda stuff on Linux and Windows etc then C or C++ are the way to go.

  8. #38
    Registered User Mobidoy's Avatar
    Join Date
    May 2007
    Posts
    18
    Only a hobby for me means, making little funny games (rpg) and applications for my kids to learn there maths (Son is 14, daughters are 11 and 6) so the range is wide, more complicate maths for son, + - * and / for the 11 years old, and + - for the 6 years old. This can all fit in 1 application, just have to set a menu.

    I know i can find such things but, i want to do it on my own (Remember, hobby).

    Also, i will have an application for the kids to learn there spelling words and verbs, there are so many twists in french, i want it to put up the rule if they make a mistake. (like it must be an M if it is before a P like Temperature not tenperature). Thing like that . I will also have have the application that will ask me the words to study, save them in a file, then ask to record the word in a .wav or some sound file and associate it with the word. That way, the kid can click on the play sound button and, then, type in the word

    Off topic, How do you pronounce the "ger" in "integer":

    is it like th Ger in Germany or;

    like the ger in Hamburger ?

    Sorry for being a french canadian, not my choice lol !!
    Last edited by Mobidoy; 05-24-2007 at 06:48 AM.

  9. #39
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    I dunno what the international way of saying it is, but I say it such as INT-EH-JUR. (Like the 'Ger' in Germany)

    You may also like to know that doing string processing in C or C++ is rather annoying and complex considered to other langauges like Perl and Python.

  10. #40
    Registered User Mobidoy's Avatar
    Join Date
    May 2007
    Posts
    18
    Cool, this means more challenge

    Bug finding and head banging is what i like the most.
    If your code fail, blame Canada !

    If your code makes your computer crash, Blame me, i'm a french canadian !!

  11. #41
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Move straight so assembly then?
    Last edited by zacs7; 05-24-2007 at 07:02 AM. Reason: I can't spell :(

  12. #42
    Registered User Mobidoy's Avatar
    Join Date
    May 2007
    Posts
    18
    Lol, gimmie a chance.
    If your code fail, blame Canada !

    If your code makes your computer crash, Blame me, i'm a french canadian !!

  13. #43
    Registered User
    Join Date
    May 2007
    Posts
    5

    Cool ok, i agree but...

    C is a good choice for programming language and if you are stuck with it you can still learn the better language C++ because complex program can be easily programmed using OOP concept and the procedural programming concept of programming of C sometimes makes long programs rather complex.
    I'll still say If you are starting afresh better choose C++.

    ---------------------------------
    http://learning-computer-programming.blogspot.com

  14. #44
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    C is a good choice for programming language and if you are stuck with it you can still learn the better language C++ because complex program can be easily programmed using OOP concept and the procedural programming concept of programming of C sometimes makes long programs rather complex.
    I'll still say If you are starting afresh better choose C++.
    C++ is not "better" than C, it just simplifies a few things and introduces the advent of OOP. So in that statement, you are basicly saying to the OP if he/she gets stuck on somthing then give up and try somthing "easier?" C++ is not an easy language to learn. It is a larger langage than C and much more in-depth. If you get stuck on somthing, surely that only enciurages you to attempt to solve the problem and learn from the expereicne. Amd isnt that one of the main pulls to programming in the first place?
    Double Helix STL

  15. #45
    Registered User Mobidoy's Avatar
    Join Date
    May 2007
    Posts
    18
    Swgh, this is what i am looking for I love to bang my head to find out how to do something, i love it even more if what i did doesn't work as intended. Why ? Because that way, i have to find what i did wrong and search forums, look thru posts, help file etc... to find something similar if i cant sort it myself. This is the challenge and the funniest part of it.

    When i do post, it's because i really cant find it, not because i go the easy way. Also, i will post if i find a solution to my problem and i want to know if there was a better way to do it. Like this :

    Hello everyone,

    in the book that i am using to learn c# and how to programm, i have to build this little application, what it does is quite obvious, it replace the "r" by "w" in all of the sentence. When i ran the app, i noticed that the capital R were not replaced (i understand, r and R are not the samething so, i added the line:

    sentence = sentence.Replace("R", "W");

    So what i would like to know is:

    Is there another way to do it without the extra line ?


    static void Main(string[] args)
    {
    string sentence;

    Console.Write("Type a sentence ");
    sentence = Console.ReadLine();
    Console.WriteLine("");
    sentence = sentence.Replace("R", "W");
    Console.WriteLine(sentence.Replace("r", "w"));

    Console.ReadLine();
    Just for info, this is the solution i got (It's C# btw)

    sentence = sentence.Replace("R", "W").Replace("r", "w");

    Console.WriteLine(sentence);
    If your code fail, blame Canada !

    If your code makes your computer crash, Blame me, i'm a french canadian !!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What language did they make Java in?
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 07-03-2005, 04:18 PM
  2. Strange loop
    By D@rk_force in forum C++ Programming
    Replies: 22
    Last Post: 12-18-2004, 02:40 PM
  3. assembly language...the best tool for game programming?
    By silk.odyssey in forum Game Programming
    Replies: 50
    Last Post: 06-22-2004, 01:11 PM
  4. Language of choice after C++
    By gandalf_bar in forum A Brief History of Cprogramming.com
    Replies: 47
    Last Post: 06-15-2004, 01:20 AM
  5. Languages dying
    By Zewu in forum A Brief History of Cprogramming.com
    Replies: 31
    Last Post: 07-29-2003, 10:08 AM