Requesting help for programming/ CS majors?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Superfreak04
    D7 Elite Keymasher
    • Jan 2007
    • 2407

    #46
    Re: Requesting help for programming/ CS majors?

    Originally posted by Fission
    i'm not sure why C idiom solutions are being suggested when the OP specifically mentioned C++. it's a terrible idea to mix and match them, don't do it.
    Yes, if we could, I would like only C++ solutions. Teacher will probably be confused as to why I'm mixing them, and how I would know them, since it's intro.

    Comment

    • rushyrulz
      Digital Dancing!
      FFR Simfile Author
      FFR Music Producer
      • Feb 2006
      • 12985

      #47
      Re: Requesting help for programming/ CS majors?

      What we're suggesting is the logical solution and algorithms to accomplish the task. I would take the code examples' syntax with a grain of salt and just try to decipher the logic and perhaps write down a pseudocode algorithm that can then be programmed into C++ with knowledge you've learned in class. (reason why I commented my code so much).

      C++ specific structures required for this assignment should have been covered in your classes.
      Did you learn any sorting algorithms in your classes, Eric? Or did they just give you the pre-defineds and tell you to run with that?
      Last edited by rushyrulz; 10-15-2013, 03:54 PM.


      Comment

      • Kibblre
        Caelondia Represent
        • Jul 2004
        • 1984

        #48
        Re: Requesting help for programming/ CS majors?

        I tried to make my code so that it would match what you'd be learning in your introductory course. I think I haven't done anything too out of the ordinary.
        Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.

        Comment

        • Air En Trance
          FFR Player
          • Oct 2013
          • 17

          #49
          Re: Requesting help for programming/ CS majors?

          Originally posted by rushyrulz
          I've had much harder assignments in introductory level classes. One of my projects was to code a sieve of eratosthenes from scratch.
          isn't that just like a couple nested for loops? much easier than a bunch of awkward input handling

          Comment

          • Fission
            no
            FFR Simfile Author
            • Jan 2004
            • 1850

            #50
            Re: Requesting help for programming/ CS majors?

            Originally posted by Kibblre
            I used Java more than C++, so I don't know if there's a direct IO function to handle it. You could use getline() to take in the whole line and then use substr() to cut it down to the first character only and finally cast it as a char.
            this is completely unnecessary. just use cin.get() (generically istream::get()) if you really want to do this.

            Comment

            • Air En Trance
              FFR Player
              • Oct 2013
              • 17

              #51
              Re: Requesting help for programming/ CS majors?

              can someone explain clearly what the problem is asking

              Comment

              • Kibblre
                Caelondia Represent
                • Jul 2004
                • 1984

                #52
                Re: Requesting help for programming/ CS majors?

                Originally posted by Fission
                this is completely unnecessary. just use cin.get() (generically istream::get()) if you really want to do this.
                Like I said, I didn't a function to do that directly since I primarily know Java. I was mostly answering rushy's question and not telling superfreak to implement that.
                Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.

                Comment

                • dAnceguy117
                  new hand moves = dab
                  FFR Simfile Author
                  • Dec 2002
                  • 10097

                  #53
                  Re: Requesting help for programming/ CS majors?

                  Originally posted by Fission
                  i'm not sure why C idiom solutions are being suggested when the OP specifically mentioned C++. it's a terrible idea to mix and match them, don't do it.
                  I think we all posted disclaimers. I assumed Superfreak is short on time.

                  Comment

                  • Kibblre
                    Caelondia Represent
                    • Jul 2004
                    • 1984

                    #54
                    Re: Requesting help for programming/ CS majors?

                    For sorting in alphabetical order, here's how the bubble sort algorithm would look for you:

                    Code:
                        for(int i = 0; i < count-1; i++)
                        {
                            for(int j = 0; j < count-1; j++)
                            {
                                if(name[j+1] < name[j])
                                {
                                    char temp = name[j];
                                    name[j] = name[j+1];
                                    name[j+1] = temp;
                                }
                            }
                        }
                    Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.

                    Comment

                    • justin_ator
                      🥓<strong><span style="col
                      • Mar 2007
                      • 7648

                      #55
                      Re: Requesting help for programming/ CS majors?

                      Only somewhat on topic but I'm going to post this anyway...

                      When I was new to programming in general it was not remotely helpful for someone to tell me "here's the code in Java, just convert it" because I had NO idea how Java worked either at the time... not saying it didn't help you Eric, but damn did that always frustrate me when people did that.




                      Isn't coding so much fun though? :3

                      Comment

                      • Fission
                        no
                        FFR Simfile Author
                        • Jan 2004
                        • 1850

                        #56
                        Re: Requesting help for programming/ CS majors?

                        Originally posted by Kibblre
                        Like I said, I didn't a function to do that directly since I primarily know Java. I was mostly answering rushy's question and not telling superfreak to implement that.
                        i know, i'm just saying that this is the preferred way to extract characters from an input stream

                        Originally posted by dAnceguy117
                        I think we all posted disclaimers. I assumed Superfreak is short on time.
                        fair enough

                        one thing that the OP never mentioned and i think is somewhat important is the size of the character array. can you give more detail on this? that is, is there a size restriction? if you want to do this properly, you should be using a dynamically allocated array (sticking to arrays only) or a vector.

                        Comment

                        • Kibblre
                          Caelondia Represent
                          • Jul 2004
                          • 1984

                          #57
                          Re: Requesting help for programming/ CS majors?

                          Originally posted by Fission
                          one thing that the OP never mentioned and i think is somewhat important is the size of the character array. can you give more detail on this? that is, is there a size restriction? if you want to do this properly, you should be using a dynamically allocated array or an vector.
                          I asked about vectors, it has to be an array. I think they're expected to just use an arbitrary size hence the special character that needs to be inputted.
                          Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.

                          Comment

                          • dAnceguy117
                            new hand moves = dab
                            FFR Simfile Author
                            • Dec 2002
                            • 10097

                            #58
                            Re: Requesting help for programming/ CS majors?

                            Originally posted by justin_ator
                            When I was new to programming in general it was not remotely helpful for someone to tell me "here's the code in Java, just convert it" because I had NO idea how Java worked either at the time... not saying it didn't help you Eric, but damn did that always frustrate me when people did that.
                            the best way to have this not happen is to not ask for code snippets from other people. one can instead read notes/slides, watch tutorials, go to TA/prof office hours, start assignments early...

                            but no one is here to judge

                            Originally posted by Fission
                            one thing that the OP never mentioned and i think is somewhat important is the size of the character array. can you give more detail on this? that is, is there a size restriction? if you want to do this properly, you should be using a dynamically allocated array (sticking to arrays only) or a vector.
                            the "intro" solution would just be to make a huge static array, heh

                            Comment

                            • Superfreak04
                              D7 Elite Keymasher
                              • Jan 2007
                              • 2407

                              #59
                              Re: Requesting help for programming/ CS majors?

                              Originally posted by Fission
                              i know, i'm just saying that this is the preferred way to extract characters from an input stream


                              fair enough

                              one thing that the OP never mentioned and i think is somewhat important is the size of the character array. can you give more detail on this? that is, is there a size restriction? if you want to do this properly, you should be using a dynamically allocated array (sticking to arrays only) or a vector.
                              The array can be as big as your name. So if I was to input Eric Herrera, it would be 11, right? What I wrote at the beginning, numbers 1 2 and 3, is literally what the teacher wrote out. So if anything, your guess is as good as mine.

                              Comment

                              • Kibblre
                                Caelondia Represent
                                • Jul 2004
                                • 1984

                                #60
                                Re: Requesting help for programming/ CS majors?

                                Originally posted by Superfreak04
                                The array can be as big as your name. So if I was to input Eric Herrera, it would be 11, right? What I wrote at the beginning, numbers 1 2 and 3, is literally what the teacher wrote out. So if anything, your guess is as good as mine.
                                Yeah you could do that. I was assuming you'd either have to pick the size of your name or just pick a value that you know you wouldn't reach. If you did that, you'd have to change the code I gave you slightly since you wouldn't need the count variable any more since you know it would be 11.
                                Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.

                                Comment

                                Working...