Closed Thread
Page 2 of 7 FirstFirst 1234 ... LastLast
Results 11 to 20 of 64

Thread: C necessary before C++?

  1. #11
    Join Date
    Jul 2006
    Posts
    16,448
    Blog Entries
    74
    Rep Power
    143

    Re: C necessary before C++?

    Here's an example of how C++ can help you in ways C can't:
    Code:
    #include <gmpxx.h>
    #include <iostream>
    using std::cout;
    using std::cin;
    
    int main()
    {
      int num;
      cout<<"Pick the number you want to raise to a factorial: ";
      cin<<num;
      mpz_class fact=1;
      for(int j=1;j<=num;j++)
        fact*=j;
      cout<<num<<"! = "<<fact<<"\n";
      return 0;
    }
    It uses the GNU Multi-Precision library, which provides a class for arbitrarily large "integers". As a result, it is object oriented. The class is a wrapper for a collection of C functions, so you can use this library with C as well. However, just looking at the code, it appears to be a simple procedural program with a funny data type. This is the power of C++. You can create classes that simply get out of your way and let you work without thinking too much about them. The C version of this program, using the same library, is much more complicated and imposes more responsibility on the user.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #12
    Join Date
    Mar 2009
    Posts
    1,375
    Rep Power
    24

    Re: C necessary before C++?

    Interesting elaboration, Winged. So is this topic going wider? Perhaps we could ask: should he learn assembler before C before C++ before C#?

  4. #13
    Join Date
    Jul 2006
    Posts
    16,448
    Blog Entries
    74
    Rep Power
    143

    Re: C necessary before C++?

    I'd say that C# is more of an aside to the C/C++ debate. C# borrows more from Java than from C++, though Java of course takes a lot of ideas from C++.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  5. #14
    outsid3r's Avatar
    outsid3r is offline Programming God
    Join Date
    Jul 2008
    Posts
    621
    Rep Power
    18

    Re: C necessary before C++?

    Quote Originally Posted by WingedPanther View Post
    I'd say that C# is more of an aside to the C/C++ debate. C# borrows more from Java than from C++, though Java of course takes a lot of ideas from C++.
    Although C++ is very different from both in my opinion.

  6. #15
    Join Date
    Jul 2006
    Location
    Amherst, New York, United States
    Posts
    6,277
    Blog Entries
    26
    Rep Power
    20

    Re: C necessary before C++?

    Quote Originally Posted by outsid3r View Post
    Yea, in all universities they teach C before C++ for people know the differences between programming paradigms.
    Be careful with your use of universal quantification. I am in my fourth year of university, and I've yet to learn C.

  7. #16
    Raitt is offline Newbie
    Join Date
    Jun 2009
    Posts
    6
    Rep Power
    0

    Re: C necessary before C++?

    In our univercity C++ is studied at the first semester but education program don't give sufficient attention for C, so some students don't understand differents between this languages I think it's wrong

  8. #17
    outsid3r's Avatar
    outsid3r is offline Programming God
    Join Date
    Jul 2008
    Posts
    621
    Rep Power
    18

    Re: C necessary before C++?

    Quote Originally Posted by Raitt View Post
    In our univercity C++ is studied at the first semester but education program don't give sufficient attention for C, so some students don't understand differents between this languages I think it's wrong
    It isn't really necessary to teach C for u to understand the differences between two paradigms, there are many procedural languages like C.

  9. #18
    outsid3r's Avatar
    outsid3r is offline Programming God
    Join Date
    Jul 2008
    Posts
    621
    Rep Power
    18

    Re: C necessary before C++?

    Quote Originally Posted by John View Post
    Be careful with your use of universal quantification. I am in my fourth year of university, and I've yet to learn C.
    well, that's really very strange, what languages had you learned in university?

  10. #19
    Chinmoy's Avatar
    Chinmoy is offline Programming Expert
    Join Date
    Feb 2008
    Location
    where heaven meets earth
    Posts
    410
    Rep Power
    18

    Re: C necessary before C++?

    definitely not. They are two different things. People are often made into believing that learning c helps before c++. I would say, do not waste your time, go for c++ straight and then come back to C just to learn the diferences in usage, there are only a few. read here :: Differences between c and c++ | TECHARRAZ
    God is real... unless declared an integer

  11. #20
    Ultma2 is offline Newbie
    Join Date
    Jun 2009
    Posts
    1
    Rep Power
    0

    Re: C necessary before C++?

    No C is not necessary before C++. They are two different languages, you dont need to know C before learning C++

Closed Thread
Page 2 of 7 FirstFirst 1234 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts