Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. I use C++ all the time!!

I use C++ all the time!!

Scheduled Pinned Locked Moved The Lounge
c++tutorialquestioncareer
23 Posts 10 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F fanyeqing

    It seems you didn't even write a class. Personally I think it would be better if you wrote:

    class MyClass
    {
    public:
    void MyDoSomething( const std::string & myCompareValue )
    {
    blablabla...
    }

    void MyDoSomethingOnListString(const std::string & myCompareValue )
    {
    for (int C = 0; C < myListString.size(); C++)
    {
    if (myListString[C] == myCompareValue) { MyDoSomething(myListString[C]); }
    }
    }

    private:
    std::vector myListString;

    };

    L Offline
    L Offline
    LloydA111
    wrote on last edited by
    #5

    Ah yes, the habit of turning even the smallest of code into a hundred and one classes.

           .-.
          |o,o|
       ,| \_\\=/\_      .-""-.
       ||/\_/\_\\\_\\    /\[\] \_ \_\\
       |\_/|(\_)|\\\\  \_|\_o\_LII|\_
          \\.\_./// / | ==== | \\
          |\\\_/|"\` |\_| ==== |\_|
          |\_|\_|    ||" ||  ||
          |-|-|    ||LI  o ||
          |\_|\_|    ||'----'||
         /\_/ \\\_\\  /\_\_|    |\_\_\\
    
    1 Reply Last reply
    0
    • M MacSpudster

      During a recent interview I was asked if I use C++. I said, "Sure, I use C++ all the time!!" They asked me to to write some example code with C++. So I did. Here's what I wrote:

      for (int C = 0; C < myListString.Count; C++)
      {
      if (myListString[C] == myCompareValue) { this.MyDoSomething(myListString[C]); }
      }

      A week later I received the standard decline letter from them. :( + :confused: That's struck me as odd, because I'm confident I wrote some really good example code with C++. ;P (Made this up myself. OK, Now it's your turn ... reply with your [clean] parody [or parity..?!] code joke!)

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #6

      I think we should give him the job: he used "C++" in one of the lines:

      for (int C = 0; C < myListString.Count; C++)

      The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      M 1 Reply Last reply
      0
      • M MacSpudster

        During a recent interview I was asked if I use C++. I said, "Sure, I use C++ all the time!!" They asked me to to write some example code with C++. So I did. Here's what I wrote:

        for (int C = 0; C < myListString.Count; C++)
        {
        if (myListString[C] == myCompareValue) { this.MyDoSomething(myListString[C]); }
        }

        A week later I received the standard decline letter from them. :( + :confused: That's struck me as odd, because I'm confident I wrote some really good example code with C++. ;P (Made this up myself. OK, Now it's your turn ... reply with your [clean] parody [or parity..?!] code joke!)

        S Offline
        S Offline
        Shao Voon Wong
        wrote on last edited by
        #7

        You did not get the job because you wrote C# code! C# code

        this.MyDoSomething(myListString[C]);

        C++ code should access this ptr like this-> instead of this.!

        this->MyDoSomething(myListString[C]);

        M 1 Reply Last reply
        0
        • M MacSpudster

          During a recent interview I was asked if I use C++. I said, "Sure, I use C++ all the time!!" They asked me to to write some example code with C++. So I did. Here's what I wrote:

          for (int C = 0; C < myListString.Count; C++)
          {
          if (myListString[C] == myCompareValue) { this.MyDoSomething(myListString[C]); }
          }

          A week later I received the standard decline letter from them. :( + :confused: That's struck me as odd, because I'm confident I wrote some really good example code with C++. ;P (Made this up myself. OK, Now it's your turn ... reply with your [clean] parody [or parity..?!] code joke!)

          C Offline
          C Offline
          CPallini
          wrote on last edited by
          #8

          Maybe they were not able to understand.

          Veni, vidi, vici.

          M 1 Reply Last reply
          0
          • Mike HankeyM Mike Hankey

            Maybe it wasn't the code, sometimes it just don't click! (You or them or both)

            VS2010/Atmel Studio 6.1 ToDo Manager Extension Some days, it's just not worth chewing through the restraints.

            M Offline
            M Offline
            MacSpudster
            wrote on last edited by
            #9

            You do realize I posted a joke, yes?!

            The best way to improve Windows is run it on a Mac. The best way to bring a Mac to its knees is to run Windows on it. ~ my brother Jeff

            Mike HankeyM 1 Reply Last reply
            0
            • S Shao Voon Wong

              You did not get the job because you wrote C# code! C# code

              this.MyDoSomething(myListString[C]);

              C++ code should access this ptr like this-> instead of this.!

              this->MyDoSomething(myListString[C]);

              M Offline
              M Offline
              MacSpudster
              wrote on last edited by
              #10

              You do realize I posted a joke, yes?! Look closely at the code and you will see that "C++" is used ...

              The best way to improve Windows is run it on a Mac. The best way to bring a Mac to its knees is to run Windows on it. ~ my brother Jeff

              1 Reply Last reply
              0
              • C CPallini

                Maybe they were not able to understand.

                Veni, vidi, vici.

                M Offline
                M Offline
                MacSpudster
                wrote on last edited by
                #11

                You do realize I posted a joke, yes?!

                The best way to improve Windows is run it on a Mac. The best way to bring a Mac to its knees is to run Windows on it. ~ my brother Jeff

                C 1 Reply Last reply
                0
                • H H Brydon

                  A few notes: - The code that typically shows up in this context usually has a break following the MyDoSomething() call - The context is vague but did they ask for some specific functionality? This is only a portion of a method.   -> It won't compile as is   -> Variables not declared   -> It isn't really complicated (but did they ask for that?)   -> The code looks more like C than C++ - I also typically use prefix increment (++C instead of C++) in the for loop. - myListString.Count is calculated every time through the loop ... (is this a property or data member?) can this be cached? - I'm not partial to your variable name, formatting or indentation ... but that is just me. My criticisms are pretty minor and I wouldn't reject you for this content. Maybe another candidate impressed them just a little more than you. I wouldn't get upset about the rejection. The rule of thumb I have for interviews is that you need to do about 10 applications for 5 interviews that might lead to 2 offers.

                  -- Harvey

                  M Offline
                  M Offline
                  MacSpudster
                  wrote on last edited by
                  #12

                  You do realize I posted a joke, yes?! Look closely at the code and you will see that "C++" is used ...

                  The best way to improve Windows is run it on a Mac. The best way to bring a Mac to its knees is to run Windows on it. ~ my brother Jeff

                  H 1 Reply Last reply
                  0
                  • OriginalGriffO OriginalGriff

                    I think we should give him the job: he used "C++" in one of the lines:

                    for (int C = 0; C < myListString.Count; C++)

                    The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

                    M Offline
                    M Offline
                    MacSpudster
                    wrote on last edited by
                    #13

                    *Finally*! Someone got the joke!

                    The best way to improve Windows is run it on a Mac. The best way to bring a Mac to its knees is to run Windows on it. ~ my brother Jeff

                    1 Reply Last reply
                    0
                    • M MacSpudster

                      You do realize I posted a joke, yes?!

                      The best way to improve Windows is run it on a Mac. The best way to bring a Mac to its knees is to run Windows on it. ~ my brother Jeff

                      Mike HankeyM Offline
                      Mike HankeyM Offline
                      Mike Hankey
                      wrote on last edited by
                      #14

                      Sorry my bad, long hours and little sleep have taken there toll....never mind! :)

                      VS2010/Atmel Studio 6.1 ToDo Manager Extension Some days, it's just not worth chewing through the restraints.

                      1 Reply Last reply
                      0
                      • M MacSpudster

                        You do realize I posted a joke, yes?!

                        The best way to improve Windows is run it on a Mac. The best way to bring a Mac to its knees is to run Windows on it. ~ my brother Jeff

                        C Offline
                        C Offline
                        CPallini
                        wrote on last edited by
                        #15

                        Yes I do. Now be a man and face it. ;P

                        Veni, vidi, vici.

                        1 Reply Last reply
                        0
                        • M MacSpudster

                          You do realize I posted a joke, yes?! Look closely at the code and you will see that "C++" is used ...

                          The best way to improve Windows is run it on a Mac. The best way to bring a Mac to its knees is to run Windows on it. ~ my brother Jeff

                          H Offline
                          H Offline
                          H Brydon
                          wrote on last edited by
                          #16

                          BCantor wrote:

                          You do realize I posted a joke, yes?!

                          Actually no - I've seen far worse code produced by serious developers. In fact, I would go so far as to say that your code is better than your humor.

                          -- Harvey

                          M 1 Reply Last reply
                          0
                          • M MacSpudster

                            During a recent interview I was asked if I use C++. I said, "Sure, I use C++ all the time!!" They asked me to to write some example code with C++. So I did. Here's what I wrote:

                            for (int C = 0; C < myListString.Count; C++)
                            {
                            if (myListString[C] == myCompareValue) { this.MyDoSomething(myListString[C]); }
                            }

                            A week later I received the standard decline letter from them. :( + :confused: That's struck me as odd, because I'm confident I wrote some really good example code with C++. ;P (Made this up myself. OK, Now it's your turn ... reply with your [clean] parody [or parity..?!] code joke!)

                            _ Offline
                            _ Offline
                            _Marshall
                            wrote on last edited by
                            #17

                            I thought it was quite funny indeed... :laugh: :laugh:

                            1 Reply Last reply
                            0
                            • H H Brydon

                              BCantor wrote:

                              You do realize I posted a joke, yes?!

                              Actually no - I've seen far worse code produced by serious developers. In fact, I would go so far as to say that your code is better than your humor.

                              -- Harvey

                              M Offline
                              M Offline
                              MacSpudster
                              wrote on last edited by
                              #18

                              Well, here's a few to try: When you go to pay for something, ask the cashier if you can receive half-off twice as much the price (I only do this when things seems slow at the checkout; cuz it takes a moment or two to do...) The cashier will say they are not allowed to do that kind of "special" (even though you didn't say "special") or that they don't know how to ring that price up if they could. Maintain a sincere yet puzzled composure (I kind of keep that happy but perplexed look on my face) as to why you won't receive half-off twice as much. Then ask them if they even know what half-off twice as much is (all the while smiling, sort of like yer letting them know yer having fun chatting with 'em.) They'll usually figure it out by then and chuckle along with ya. ===== Or, ask if they take plastic. When they say yes, hand 'em your Library Card saying, "Great! Here's my Library Card!!" (while having an excited/happy yet fully showing you are kidding them kind of face.) Again, I only do this when it's slow or a Monday and do it in a way as to "lift" them up in sharing of some fun, per se.

                              Life is Precious. CarryTheTruth

                              1 Reply Last reply
                              0
                              • M MacSpudster

                                During a recent interview I was asked if I use C++. I said, "Sure, I use C++ all the time!!" They asked me to to write some example code with C++. So I did. Here's what I wrote:

                                for (int C = 0; C < myListString.Count; C++)
                                {
                                if (myListString[C] == myCompareValue) { this.MyDoSomething(myListString[C]); }
                                }

                                A week later I received the standard decline letter from them. :( + :confused: That's struck me as odd, because I'm confident I wrote some really good example code with C++. ;P (Made this up myself. OK, Now it's your turn ... reply with your [clean] parody [or parity..?!] code joke!)

                                T Offline
                                T Offline
                                TheGreatAndPowerfulOz
                                wrote on last edited by
                                #19

                                That's not really a joke, it's more of a pun. Very subtle. The syntax (as someone else pointed out) is not even C++, more C#

                                If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams
                                You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering.-Wernher von Braun
                                Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein

                                M 1 Reply Last reply
                                0
                                • T TheGreatAndPowerfulOz

                                  That's not really a joke, it's more of a pun. Very subtle. The syntax (as someone else pointed out) is not even C++, more C#

                                  If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams
                                  You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering.-Wernher von Braun
                                  Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein

                                  M Offline
                                  M Offline
                                  MacSpudster
                                  wrote on last edited by
                                  #20

                                  Of course it is NOT C++, it is C#. But "C++" is used in the code. A pun is a single sentence statement, wherein a joke is 1 or more sentences culminating in a punch line. My joke does end with a punch line, albeit quasi-subtle. :~ Man, I guess humor is a NO-NO around here or something. :sigh:

                                  T 1 Reply Last reply
                                  0
                                  • M MacSpudster

                                    Of course it is NOT C++, it is C#. But "C++" is used in the code. A pun is a single sentence statement, wherein a joke is 1 or more sentences culminating in a punch line. My joke does end with a punch line, albeit quasi-subtle. :~ Man, I guess humor is a NO-NO around here or something. :sigh:

                                    T Offline
                                    T Offline
                                    TheGreatAndPowerfulOz
                                    wrote on last edited by
                                    #21

                                    Bad or childish humor is not always welcomed, good humor is always welcome.

                                    If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams
                                    You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering.-Wernher von Braun
                                    Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein

                                    M 1 Reply Last reply
                                    0
                                    • T TheGreatAndPowerfulOz

                                      Bad or childish humor is not always welcomed, good humor is always welcome.

                                      If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams
                                      You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering.-Wernher von Braun
                                      Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein

                                      M Offline
                                      M Offline
                                      MacSpudster
                                      wrote on last edited by
                                      #22

                                      Your reply begs the question, for such is implied within the reply in the mind of this reader, that question being: Are you implying that the joke posted was bad or childish? If yes, do elaborate; realizing full-well your qualifier of such is wholly subjective.

                                      T 1 Reply Last reply
                                      0
                                      • M MacSpudster

                                        Your reply begs the question, for such is implied within the reply in the mind of this reader, that question being: Are you implying that the joke posted was bad or childish? If yes, do elaborate; realizing full-well your qualifier of such is wholly subjective.

                                        T Offline
                                        T Offline
                                        TheGreatAndPowerfulOz
                                        wrote on last edited by
                                        #23

                                        I imply nothing, but you may infer whatever you like.

                                        If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams
                                        You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering.-Wernher von Braun
                                        Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein

                                        1 Reply Last reply
                                        0
                                        Reply
                                        • Reply as topic
                                        Log in to reply
                                        • Oldest to Newest
                                        • Newest to Oldest
                                        • Most Votes


                                        • Login

                                        • Don't have an account? Register

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • World
                                        • Users
                                        • Groups