How do you...

This is a discussion on How do you... within the C Programming forums, part of the General Programming Boards category; Alright I know that you can't compile C code in a C++ compilers so when people are making programs how ...

  1. #1
    CAP
    CAP is offline
    Registered User CAP's Avatar
    Join Date
    May 2002
    Posts
    179

    Question How do you...

    Alright I know that you can't compile C code in a C++ compilers so when people are making programs how do they write some simple things in C code and then more complex ones in C++

    I know this has probably been asked a million times before but pleae help out a beginner.
    -Microsofts Visual C++ Introductory Kit-
    Current Projects: Learning Everything C.

    Everyone has a photographic memory, some people just don't have any film.
    ______________________________

    When was the last time you went for a colon cleansing? Because quite frankly, you're so backed up with crap that it's spilling out your mouth

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    194
    c++ compilers can compile c code.

  3. #3
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    > how do they write some simple things in C code and then more complex ones in C++
    Such as?
    The world is waiting. I must leave you now.

  4. #4
    CAP
    CAP is offline
    Registered User CAP's Avatar
    Join Date
    May 2002
    Posts
    179
    I am trying to learn C or C++ so I am not quite sure but I made another thread and one person said that there is some "stuff" that you just can't do with C++ that you can only do in C. And on the second page someone says that you can't compile C code in a C++ compiler, I am not sure if he is wrong, you are wrong, or I just missread the question(probably pretty likely) here is the address if you want to check it out.
    http://www.cprogramming.com/cboard/s...threadid=18542
    -Microsofts Visual C++ Introductory Kit-
    Current Projects: Learning Everything C.

    Everyone has a photographic memory, some people just don't have any film.
    ______________________________

    When was the last time you went for a colon cleansing? Because quite frankly, you're so backed up with crap that it's spilling out your mouth

  5. #5
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    > It is most said around a lot of places that you should learn C++ before C
    WTF
    Yes, since C++ is the "son" or "daughter" of C, lets learn C++ first!

    You're probably pretty confused 'eh?
    The major differenence, or least one of them, between the 2 "Versions of the language", is the fact that C++ has classes.

    C "came out first" (keeping it simple here).
    You can make nearly anything with C.
    Yes, it would be wise to learn C++ and get your feet wet with assembly, but for now, stick to getting the syntax of C down.
    Understand it's tricks, and traps, and use it well.

    As far as what compiles on what:
    C can only compile on a C compiler.
    C files have the extension or suffix of .c
    printf is C syntax as opposed to C++'s cout

    C++ can only compile on a C++ compiler.
    C++ files have the extension or suffix of .cpp
    cout is C++ syntax as opposed to C's printf

    C, and C++, can both compile on C / C++ cross compilers.
    My compiler that I use, MingW which is a Win32 port of the GNU Compiler Collection, can do this, provided I have the file exensions labled properly, and the source file has the correct syntax for C or C++.
    The world is waiting. I must leave you now.

  6. #6
    CAP
    CAP is offline
    Registered User CAP's Avatar
    Join Date
    May 2002
    Posts
    179
    Can anyone give me the site (s) that I can download the compilers from.
    I have Microsofts Intro and it is ok for me cause I am starting but is there a site that you can give me that is free and will give me a compiler that will do both C and C++ code??
    Thanks
    -Microsofts Visual C++ Introductory Kit-
    Current Projects: Learning Everything C.

    Everyone has a photographic memory, some people just don't have any film.
    ______________________________

    When was the last time you went for a colon cleansing? Because quite frankly, you're so backed up with crap that it's spilling out your mouth

  7. #7
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Originally posted by CAP
    Can anyone give me the site (s) that I can download the compilers from.
    Read the faq
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  8. #8
    Perverted unanimous's Avatar
    Join Date
    Oct 2001
    Posts
    336

    Post C before C++

    Shadow, I have read a conversation with Bjarne Stestroup and he said it is a good idea to learn C++ first because that way you start learning OOP and you can understand it better because many people have difficulties grasping OOP after using C.
    Give me a bad reputation!!!

  9. #9
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    > many people have difficulties grasping OOP after using C
    Understand how C / C++ programming works by trying out C first.
    Learn how everything works.

    Then, take a stab at C++.

    > it is a good idea to learn C++ first because that way you start learning OOP
    Flawed logic.
    If you have absolutely zero programming knowledge, OOP is something you will not grasp at all.

    That's without mentioning that OOP is way off topic.

    > Bjarne Stestroup
    I'm glad I know of their opinions. Probably a very bright person.
    The world is waiting. I must leave you now.

  10. #10
    Registered User
    Join Date
    Sep 2001
    Posts
    305
    ahhh!! learn C first, i strongly recommend it. then, once you somehow feel the limit, learn C++. C is still dominating the industry, but that will soon change because the age of OOP has begun!! sorry, been playing too many rpgs lately.

  11. #11
    *
    Guest
    > Shadow, I have read a conversation with Bjarne Stestroup
    > and he said it is a good idea to learn C++ first because that
    > way you start learning OOP and you can understand it
    > better because many people have difficulties grasping
    > OOP after using C.

    I have had several opportunities to talk with Bjarne, and truthfully, OOP is no big deal. Aside from 'abstraction', OOP is nothing more than modularization-- something C programmers were doing long before C++ was added to C.

    Bjarne didn't like C simply because it was too restrictive (doesn't allow data or variable abstraction).

    ---

    However, I do agree that once you learn C it can be difficult to learn C++, not because OOP concepts are difficult, but because C++ is so abstract.

    C programmers tend to be "nuts & bolts"-- break things down to their processes, while C++ programmers tend to work at a much higher level. C++ programmers tend to work toward end-product concepts, without ever knowing really how things work under the hood. That is not meant as a put down, just a generalization that I've observed.

    At present C will allow you to write any kind of program you desire. If you choose to use C++, and are comfortable with it, it will get you there to. Neither one will "do" more or less than the other. People who are such things are confusing the compiled end-product executable, with syntax issues of the language.

    C++ does not generate code that is as effecient or as fast as C. That is _not_ a fault of the language, but rather a fault of the compiler technology to date.

    Go to the library, read a chapter from a C book and one from a C++ book-- see which one is easier and go with that.

  12. #12
    CAP
    CAP is offline
    Registered User CAP's Avatar
    Join Date
    May 2002
    Posts
    179
    Ok from what I see(and assumed) it IS a good idea to learn C first because it was made first then C++ was the upgrade. I will try the book in my library thanks.
    -Microsofts Visual C++ Introductory Kit-
    Current Projects: Learning Everything C.

    Everyone has a photographic memory, some people just don't have any film.
    ______________________________

    When was the last time you went for a colon cleansing? Because quite frankly, you're so backed up with crap that it's spilling out your mouth

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21