Like Tree5Likes

Exercise solutions from "Accelerated C++" (Koenig/Moo)

This is a discussion on Exercise solutions from "Accelerated C++" (Koenig/Moo) within the C++ Programming forums, part of the General Programming Boards category; Phew. Well, that's good. What I actually meant here tho: So someone has now pointed out to you that it ...

  1. #16
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Phew. Well, that's good. What I actually meant here tho:

    So someone has now pointed out to you that it is not obvious what you want. But you did not do anything to resolve that.
    Yes, I did. I said I was sorry.
    Was that you still haven't "mentioned the specific areas that you would like your reviewers to critique". In case it wasn't clear (I would have thought it obvious, lol) the reason people reacted negatively is that you essentially walked up to a buffet table and started shovelling things into a backpack.

    Ask one specific question at a time.

    But while we're here (and I am not trying to humiliate you )...
    WRT 11-6 in post #3:

    - "avail", "limit", "data" and "alloc" are not defined, making it hard to say much beyond: it looks the two arg erase() will work (but it might not), and I dunno what shrink() is going to do.

    WRT 12-1 in post #5:

    - don't post code you have not compiled and tested, unless you are asking explicitly: I can't get this to compile, I get these errors, how do I approach this?

    - "copy" is not defined

    - You didn't tackle the fundamental issue of storage. That you are "going to deal" with data[] (which, BTW, is an error for me on g++ 4.5.3 and 4.6.2) is kind of like showing someone an engine you are rebuilding with the pistons, rods, and driveshaft missing and asking, "do you think it will run"? Of course it won't run, there's no pistons, rods, or driveshaft. Why not just do this:

    Code:
    using namespace std;
    
    int main(void) {
    
    //TODO
    
    }

    What do you think of my video processing code so far?

    In a way, 12-1 is even more ridiculous, because it all depends on how the storage works, which you still haven't worked out. That is a very bad way to write code. By basing one untested part on another untested part, you risk:

    a) wasting twice as much time re-writing both parts.
    b) repeating the same basic errors over and over when you only need to do so once, then correct it and do it properly after that.

    Rather than create three theoretical constructors, write one, make sure the code compiles and tests successfully, then move on to add other methods. Here's another analogy: you don't build a house of cards starting with the second story, figuring you can build the first one later and place the second one on top. What is the first story? The first story is the one that must work before the other ones do.
    manasij7479 likes this.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  2. #17
    Registered User
    Join Date
    Mar 2011
    Posts
    12
    Quote Originally Posted by MK27 View Post
    - "avail", "limit", "data" and "alloc" are not defined, making it hard to say much beyond: it looks the two arg erase() will work (but it might not), and I dunno what shrink() is going to do.
    As I already mentioned
    Quote Originally Posted by tap3ah View Post
    This was aimed to people actively working on those exercises, or at least own the book.
    Quote Originally Posted by MK27 View Post
    - "copy" is not defined
    copy is a standard algorithm. But don't worry, I'm not mentioning it to humiliate you either.

    Quote Originally Posted by MK27 View Post
    - You didn't tackle the fundamental issue of storage. That you are "going to deal" with data[]
    See 12-1 corrected.

    Well, thank you for your detailed dissection of my actions. I must say, your rhetorical skills match those of a politician in a peak of election campaign.

    Honestly, I think you are trying to prolong this argument indefinitely, otherwise I don't see why would you make me to repeat myself, and why would you philosophize so much over a small exercise from a beginner-level book.

    All I wanna say about the subject: I'm sorry for my ambiguity about my posts. And I'm sorry this thread turned into a flaming war, although I blame phantomotap's rudeness for that.

    cheers

  3. #18
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by tap3ah View Post
    copy is a standard algorithm. But don't worry, I'm not mentioning it to humiliate you either.

    [...]

    See 12-1 corrected.
    Whoops, but nb. my criticism of how you wrote 12-1 still applies (of course, you won't pay any attention to that now, right?).

    Well, thank you for your detailed dissection of my actions.
    You were asking for that ("Post your own solutions, or comment those posted by others").

    Honestly, I think you are trying to prolong this argument indefinitely, otherwise I don't see why would you make me to repeat myself, and why would you philosophize so much over a small exercise from a beginner-level book.
    I wasn't trying to prolong the argument, I was trying to get past it. And WRT "philosophizing over a small exercise", again, you posted it and asked for comments.

    I blame phantomotap's rudeness for that.
    Interesting that he was the only one that got you to respond in a productive way though. You two just might have been made for each other, lol.
    Last edited by MK27; 04-03-2012 at 07:39 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #19
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,370
    And I'm sorry this thread turned into a flaming war, although I blame phantomotap's rudeness for that.
    So far you've done nothing to prove my assumptions wrong even going to far to complain every time someone does point out a problem with your code, but I'll tell you what, I'll be more than happy to apologize when you start proving me wrong.

    You two just might have been made for each other, lol.
    Now there's no need to be insulting...

    Soma
    MK27 likes this.

  5. #20
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,183
    Quote Originally Posted by tap3ah
    copy is a standard algorithm.
    You should #include <algorithm> instead of relying on it being included indirectly.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #21
    Registered User
    Join Date
    May 2006
    Posts
    100
    While it is true that tap3ah has room for improvement on handling forums, phantomotap was unnecessarily mean about it. This problem was double-rooted.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Please help me with this "prime checker" exercise!
    By blackhawk65 in forum C++ Programming
    Replies: 3
    Last Post: 07-15-2010, 02:09 PM
  2. Replies: 2
    Last Post: 05-02-2010, 02:49 AM
  3. Few questions from "Accelerated C++"
    By s_siouris in forum C++ Programming
    Replies: 7
    Last Post: 04-12-2008, 03:07 PM
  4. "itoa"-"_itoa" , "inp"-"_inp", Why some functions have "
    By L.O.K. in forum Windows Programming
    Replies: 5
    Last Post: 12-08-2002, 08:25 AM
  5. "CWnd"-"HWnd","CBitmap"-"HBitmap"...., What is mean by "
    By L.O.K. in forum Windows Programming
    Replies: 2
    Last Post: 12-04-2002, 07:59 AM

Tags for this Thread


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