Thread: What can I do in c++, that I can't do in c?

  1. #106
    Old Took
    Join Date
    Nov 2016
    Location
    Londonistan
    Posts
    121
    Of course learning algorithms is important, but it can be done alongside practical work. I'm just watching the first MIT algorithm video now to see what you have learned from it. The guy talks about having to hand in code as homework. Strange that. Surely he'd prefer essays according to you. I find it kind of weird that the professor needs a sheet of notes to show an insertion sort algorithm that to me doesn't inspire confidence in his teaching.

  2. #107
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Hobbit View Post
    I find it kind of weird that the professor needs a sheet of notes to show an insertion sort algorithm that to me doesn't inspire confidence in his teaching.
    Not at all. Notes are great. That makes it so the professor can write down the algorithm, test it for mistakes and ensure that they doesn't waste time trying to find and fix bugs in what they've written. Always prefer teachers who use notes because it means they've put time and effort into the actual class!
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #108
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Ooh, back to C++ vs C, you can use implicit conversion operators.

    Code:
    // used to represent a potentially invalid index of an array
    // NOT a complete implementation
    struct index_t
    {
      long long int v; // assume 64 bit architecture ftw
    
      index_t(void) : v{-1} {}
      index_t(long long int u) : v{u} {}
    
      operator bool() const { return v >= 0; }
    };
    This way, it's easy to just if `if (x) p[x]`

  4. #109
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Terrance
    Also, while I have only watched 1 and a half MIT lectures so far, the algorithms class at MIT is clearly modeled around the theories taught in TAOCP, thus this further proves my thinking that studying the theory of TAOCP is of high value.
    You are simply ignoring the overall points made by others at this point to pontificate about something that nobody really objects about, i.e., that theory is valuable.

    In theory, we could keep going at this until this message board reaches its end of life. In practice, you need to stop posting here and start doing something productive, whether it is studying theory or applying it for practical programming, so I shall close this thread for your own good.

    If you have more specific questions on some aspect of the theory or practice of computer programming, feel free to start a new topic thread to ask about it. But if you wish to keep pontificating about TAOCP when nobody is saying that you shouldn't study it, I will simply close or delete such a thread.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Tags for this Thread