Struggling Comp Sci Student

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stan

    Struggling Comp Sci Student

    Hey everyone, I've got a computer science class and we're working on
    C++. I am struggling with nested loops and have a really simple
    assignment, but I can't get it to run the loop. I need to run a loop
    that has someone guess at a number 5 times and if they get 45, it
    tells them how many guesses they needed. It also has to tell them if
    they leave the range of guesses from 0 to 100.

    I need help.

    Can somebody help me please!!!

    Stan.
  • Mike Wahler

    #2
    Re: Struggling Comp Sci Student


    "Stan" <stans_52@netze ro.net> wrote in message
    news:82ad86b.03 10142111.66b7db eb@posting.goog le.com...[color=blue]
    > Hey everyone, I've got a computer science class and we're working on
    > C++. I am struggling with nested loops and have a really simple
    > assignment, but I can't get it to run the loop. I need to run a loop
    > that has someone guess at a number 5 times and if they get 45, it
    > tells them how many guesses they needed. It also has to tell them if
    > they leave the range of guesses from 0 to 100.
    >
    > I need help.
    >
    > Can somebody help me please!!![/color]

    Sure, show us your code, we're happy to help.
    We'll also need a bit more specific description of
    the assignment than what you've written above.


    -Mike


    Comment

    • David B. Held

      #3
      Re: Struggling Comp Sci Student

      "Stan" <stans_52@netze ro.net> wrote in message
      news:82ad86b.03 10142111.66b7db eb@posting.goog le.com...[color=blue]
      > Hey everyone, I've got a computer science class and we're
      > working on C++.
      > [...][/color]

      I believe there is a .students (or something similar) newsgroup
      for C++ which might be more helpful.

      Dave



      ---
      Outgoing mail is certified Virus Free.
      Checked by AVG anti-virus system (http://www.grisoft.com).
      Version: 6.0.521 / Virus Database: 319 - Release Date: 9/23/2003


      Comment

      • Mike Wahler

        #4
        Re: Struggling Comp Sci Student


        "David B. Held" <dheld@codelogi cconsulting.com > wrote in message
        news:bmiqkf$9p2 $1@news.astound .net...[color=blue]
        > "Stan" <stans_52@netze ro.net> wrote in message
        > news:82ad86b.03 10142111.66b7db eb@posting.goog le.com...[color=green]
        > > Hey everyone, I've got a computer science class and we're
        > > working on C++.
        > > [...][/color]
        >
        > I believe there is a .students (or something similar) newsgroup
        > for C++ which might be more helpful.[/color]

        I've never heard of .students groups, but I suppose
        there could be some.

        However, many here (including myself) will be happy
        to help this person. Looks like you're chasing him
        away. How come?


        -Mike


        Comment

        • David White

          #5
          Re: Struggling Comp Sci Student

          "David B. Held" <dheld@codelogi cconsulting.com > wrote in message
          news:bmiqkf$9p2 $1@news.astound .net...[color=blue]
          > "Stan" <stans_52@netze ro.net> wrote in message
          > news:82ad86b.03 10142111.66b7db eb@posting.goog le.com...[color=green]
          > > Hey everyone, I've got a computer science class and we're
          > > working on C++.
          > > [...][/color]
          >
          > I believe there is a .students (or something similar) newsgroup
          > for C++ which might be more helpful.[/color]

          Maybe you are thinking of alt.comp.lang.l earn.c-c++, but I doubt it would be
          more helpful. Beginners are welcome here too.

          DW



          Comment

          • osmium

            #6
            Re: Struggling Comp Sci Student

            Stan writes:
            [color=blue]
            > Hey everyone, I've got a computer science class and we're working on
            > C++. I am struggling with nested loops and have a really simple
            > assignment, but I can't get it to run the loop. I need to run a loop
            > that has someone guess at a number 5 times and if they get 45, it
            > tells them how many guesses they needed. It also has to tell them if
            > they leave the range of guesses from 0 to 100.[/color]

            Something along these lines:

            int guesses = 0;
            while(guesses < 100)
            {
            /*your code*/
            guesses = guesses + 1; // can be obfuscated
            }

            The detection of guesses that are out of range should be handled in the
            block I call "your code". The message telling the user the number of
            guesses he used is left to you.





            Comment

            • David B. Held

              #7
              Re: Struggling Comp Sci Student

              "Mike Wahler" <mkwahler@mkwah ler.net> wrote in message
              news:Gq6jb.1913 $s93.1091@newsr ead3.news.pas.e arthlink.net...[color=blue]
              > [...]
              > However, many here (including myself) will be happy
              > to help this person. Looks like you're chasing him
              > away. How come?[/color]

              Because of my loyalty to the newsgroup fuhrer. Heil Fehrer!
              Death to noobs! Ok, just kidding. It seems that Attila has
              been fairly moderate lately, so now I look like the Newsgroup
              Gestapo. Interesting turn of events. I don't object to anyone
              who wants to help him. However, if there is an even more
              topical newsgroup, I don't see how it is "chasing him away"
              to refer to it.

              Dave



              ---
              Outgoing mail is certified Virus Free.
              Checked by AVG anti-virus system (http://www.grisoft.com).
              Version: 6.0.521 / Virus Database: 319 - Release Date: 9/23/2003


              Comment

              • David B. Held

                #8
                Re: Struggling Comp Sci Student

                "David White" <no.email@provi ded> wrote in message
                news:YF8jb.6072 $d6.262389@nasa l.pacific.net.a u...[color=blue]
                > [...]
                > Maybe you are thinking of alt.comp.lang.l earn.c-c++,[/color]

                Ah, yes, thank you. I was probably thinking of a Borland
                newsgroup.
                [color=blue]
                > but I doubt it could be more helpful.[/color]

                You would probably know better than I.
                [color=blue]
                > Beginners are welcome here too.[/color]

                Good, because it's not always obvious who are beginners
                here to begin with. ;)

                Dave



                ---
                Outgoing mail is certified Virus Free.
                Checked by AVG anti-virus system (http://www.grisoft.com).
                Version: 6.0.521 / Virus Database: 319 - Release Date: 9/23/2003


                Comment

                • jeffc

                  #9
                  Re: Struggling Comp Sci Student


                  "David B. Held" <dheld@codelogi cconsulting.com > wrote in message
                  news:bmk3ma$fha $1@news.astound .net...[color=blue]
                  > "Mike Wahler" <mkwahler@mkwah ler.net> wrote in message
                  > news:Gq6jb.1913 $s93.1091@newsr ead3.news.pas.e arthlink.net...[color=green]
                  > > [...]
                  > > However, many here (including myself) will be happy
                  > > to help this person. Looks like you're chasing him
                  > > away. How come?[/color]
                  >
                  > Because of my loyalty to the newsgroup fuhrer. Heil Fehrer!
                  > Death to noobs! Ok, just kidding. It seems that Attila has
                  > been fairly moderate lately, so now I look like the Newsgroup
                  > Gestapo. Interesting turn of events. I don't object to anyone
                  > who wants to help him. However, if there is an even more
                  > topical newsgroup, I don't see how it is "chasing him away"
                  > to refer to it.[/color]

                  Per the FAQ, alt.comp.lang.l earn.c-c++ is supposed to more newbie-friendly.


                  Comment

                  • lilburne

                    #10
                    Re: Struggling Comp Sci Student

                    Mike Wahler wrote:[color=blue]
                    > "David B. Held" <dheld@codelogi cconsulting.com > wrote in message
                    > news:bmiqkf$9p2 $1@news.astound .net...
                    >[color=green]
                    >>"Stan" <stans_52@netze ro.net> wrote in message
                    >>news:82ad86b. 0310142111.66b7 dbeb@posting.go ogle.com...
                    >>[color=darkred]
                    >>>Hey everyone, I've got a computer science class and we're
                    >>>working on C++.
                    >>>[...][/color]
                    >>
                    >>I believe there is a .students (or something similar) newsgroup
                    >>for C++ which might be more helpful.[/color]
                    >
                    >
                    > I've never heard of .students groups, but I suppose
                    > there could be some.
                    >
                    > However, many here (including myself) will be happy
                    > to help this person. Looks like you're chasing him
                    > away. How come?
                    >[/color]

                    Erm, comp sci student, can't get a nested loop to work. I
                    know the comp sci depts all seem to be teaching java
                    nowadays ... but really.

                    Once had a 2nd year comp sci student ask "What's a dot aich
                    file?" 6 months into the course. Seems a group of them had a
                    tame final year student, who was banging out the assignments.

                    Comment

                    • Mike Wahler

                      #11
                      Re: Struggling Comp Sci Student

                      "David B. Held" <dheld@codelogi cconsulting.com > wrote in message
                      news:bmk3ma$fha $1@news.astound .net...[color=blue]
                      > "Mike Wahler" <mkwahler@mkwah ler.net> wrote in message
                      > news:Gq6jb.1913 $s93.1091@newsr ead3.news.pas.e arthlink.net...[color=green]
                      > > [...]
                      > > However, many here (including myself) will be happy
                      > > to help this person. Looks like you're chasing him
                      > > away. How come?[/color]
                      >
                      > Because of my loyalty to the newsgroup fuhrer. Heil Fehrer!
                      > Death to noobs! Ok, just kidding. It seems that Attila has
                      > been fairly moderate lately, so now I look like the Newsgroup
                      > Gestapo. Interesting turn of events. I don't object to anyone
                      > who wants to help him. However, if there is an even more
                      > topical newsgroup, I don't see how it is "chasing him away"
                      > to refer to it.[/color]

                      Your reply as seen in full context (this group) gave
                      me that impression.

                      A referral to a more specific group is always a good
                      thing. But all Stan saw from you was essentially
                      "this is better asked elsewhere.", which imo he could
                      take to mean "not topical" or perhaps "expert level
                      stuff only here," neither of which of course is the case.

                      I wasn't trying to tell you what to do, and I certainly
                      don't feel you were rude or anything like that. I simply
                      didn't understand why you replied the way you did.
                      Now I know. No big deal. :-)

                      -Mike


                      Comment

                      • Gregg

                        #12
                        Re: Struggling Comp Sci Student

                        "osmium" <r124c4u102@com cast.net> wrote in news:bmjhqj$nkl g1$1@ID-
                        179017.news.uni-berlin.de:
                        [color=blue]
                        > Stan writes:
                        >[/color]
                        [...][color=blue]
                        >
                        > Something along these lines:
                        >
                        > int guesses = 0;
                        > while(guesses < 100)
                        > {
                        > /*your code*/
                        > guesses = guesses + 1; // can be obfuscated
                        > }
                        >
                        > The detection of guesses that are out of range should be handled in the
                        > block I call "your code". The message telling the user the number of
                        > guesses he used is left to you.
                        >[/color]

                        The specification said up to 5 guesses are allowed. Ordinarily this would
                        be a nit, but since it is for a beginner, it may be worth pointing out.
                        It might also be easier if the loop has two exit conditions instead of
                        one.

                        int guesses = 0;
                        bool success = false;

                        while ((guesses < 5) && !success))
                        {
                        /* Get number */
                        /* Report if out of range */
                        /* Otherwise see if it is correct */
                        guesses = guesses + 1;
                        }

                        /* Report number of attempts and whether user got it */

                        --
                        Gregg

                        Comment

                        • WW

                          #13
                          Re: Struggling Comp Sci Student

                          David B. Held wrote:[color=blue]
                          > "Mike Wahler" <mkwahler@mkwah ler.net> wrote in message
                          > news:Gq6jb.1913 $s93.1091@newsr ead3.news.pas.e arthlink.net...[color=green]
                          >> [...]
                          >> However, many here (including myself) will be happy
                          >> to help this person. Looks like you're chasing him
                          >> away. How come?[/color]
                          >
                          > Because of my loyalty to the newsgroup fuhrer. Heil Fehrer!
                          > Death to noobs! Ok, just kidding. It seems that Attila has[/color]

                          Feher. And having a grandmother who was Jewish (well, she was catholic on
                          paper but then again she said Oh Yisrael and not Oh Jesus, which is a strong
                          hint) I take this bullshit of yours as a serious offense. And not a joke.

                          So I think it is time for you to apologize!

                          Calling someone a nazi is *not* a joke, in any way. So far I was amuzed by
                          your silly ways, but this is over the line. If you want to stay here ever
                          again as someone with a light chance to be respected, you will publicly
                          apologize! And this is not a joke either.

                          --
                          WW aka Attila


                          Comment

                          • David B. Held

                            #14
                            Re: Struggling Comp Sci Student

                            "WW" <wolof@freemail .hu> wrote in message
                            news:bmmb8q$2mi $1@phys-news1.kolumbus. fi...[color=blue]
                            > David B. Held wrote:[color=green]
                            > > [...]
                            > > Because of my loyalty to the newsgroup fuhrer. Heil
                            > > Fehrer! Death to noobs! Ok, just kidding.[/color]
                            >
                            > Feher. And having a grandmother who was Jewish (well,
                            > she was catholic on paper but then again she said Oh
                            > Yisrael and not Oh Jesus, which is a strong hint) I take this
                            > bullshit of yours as a serious offense. And not a joke.[/color]

                            So in order to be offended, you have to rely on speculative
                            ancestry? In that case, one of my ancestors might have
                            been a Jew also, and so I should be equally offended! Isn't
                            it time for Jews to stop complaining about something that
                            didn't even happen to them personally? Isn't it enough that
                            you got a special word out of it, and a state? I mean, the
                            millions of Poles, Slavs, Serbs, and other people killed by
                            the Nazis, Stalinists, Leninists, and every other brute in
                            history don't have a special term for their meaningless
                            deaths, but I've never once heard one of their ancestors
                            complain about it.
                            [color=blue]
                            > So I think it is time for you to apologize![/color]

                            You mean it's time for you to censor me.
                            [color=blue]
                            > Calling someone a nazi is *not* a joke, in any way.[/color]

                            It is when "Nazi" is a placeholder for "authoritar ian dictator",
                            and not "Jew burner". I could have used Castro, Stalin, or
                            even Mao, but people have a broader knowledge about
                            the Nazi infrastructure, so references to them are more
                            easily recognizable. Who knows what Castro's secret
                            police are called? And I thought "Feher" was a funny
                            play on "fuhrer", which is a generic term perfectly
                            describing my opinion of your behaviour sometimes.
                            From dictionary.com:

                            füh·rer also fueh·rer
                            n.

                            A leader, especially one exercising the powers of a tyrant.

                            I never said: "Fuhrer of the Third Reich," (though that
                            would not be an unreasonable inference, granted).
                            [color=blue]
                            > So far I was amuzed by your silly ways, but this is over the
                            > line. If you want to stay here ever again as someone with a
                            > light chance to be respected, you will publicly apologize![/color]

                            This is merely fodder for my point. If you can't handle some
                            satirical criticism, I'm not going to placate your censoring
                            impulse with a contrived and insincere apology. That would
                            be insulting to you (since I don't regret saying it at all), and
                            would betray the very issue I was trying to highlight: that you
                            are an authoritarian tyrant.
                            [color=blue]
                            > And this is not a joke either.[/color]

                            Yes, that's what disturbs me the most. I never justified
                            genocide or any other atrocity, and yet you are unable
                            to separate the concept of a dictator from an event in
                            history. That is dangerous, because banning speech
                            about dictators merely creates the type of environment
                            in which said dictators prefer to operate in the first place.
                            Besides burning people, Hitler loved to burn books. And
                            refusing to allow people to condemn that behaviour
                            through satire is a sad indictment on "progressiv e"
                            humanity. Satire is the act of making a point through
                            analogy, exaggeration, and humor, all at once. It surely
                            runs the risk of offending some; but often, the point being
                            made is worth that risk.

                            Dave



                            ---
                            Outgoing mail is certified Virus Free.
                            Checked by AVG anti-virus system (http://www.grisoft.com).
                            Version: 6.0.521 / Virus Database: 319 - Release Date: 9/23/2003


                            Comment

                            • sam

                              #15
                              Re: Struggling Comp Sci Student


                              "David B. Held" <dheld@codelogi cconsulting.com > wrote in message
                              news:bmmtk6$94r $1@news.astound .net...
                              [color=blue]
                              > been a Jew also, and so I should be equally offended! Isn't
                              > it time for Jews to stop complaining about something that
                              > didn't even happen to them personally?[/color]

                              so you mean i shouldn't take half of my grandmother's family being wiped out
                              personally ?
                              [color=blue]
                              > Isn't it enough that
                              > you got a special word out of it, and a state?[/color]

                              wow , a word !!!! that really makes it all worth it...
                              and a state ? what kind of a state is it when terrorists are
                              blowing people up all the time ???


                              Comment

                              Working...