Struggling Comp Sci Student

S

Stan

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.
 
M

Mike Wahler

Stan said:
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!!!

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
 
D

David B. Held

Stan said:
Hey everyone, I've got a computer science class and we're
working on C++.
[...]

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

Dave
 
M

Mike Wahler

David B. Held said:
Stan said:
Hey everyone, I've got a computer science class and we're
working on C++.
[...]

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

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
 
D

David White

David B. Held said:
Stan said:
Hey everyone, I've got a computer science class and we're
working on C++.
[...]

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

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

DW
 
O

osmium

Stan said:
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.

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.
 
D

David B. Held

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

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
 
D

David B. Held

David White said:
[...]
Maybe you are thinking of alt.comp.lang.learn.c-c++,

Ah, yes, thank you. I was probably thinking of a Borland
newsgroup.
but I doubt it could be more helpful.

You would probably know better than I.
Beginners are welcome here too.

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

Dave
 
J

jeffc

David B. Held said:
Mike Wahler said:
[...]
However, many here (including myself) will be happy
to help this person. Looks like you're chasing him
away. How come?

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.

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

lilburne

Mike said:
Hey everyone, I've got a computer science class and we're
working on C++.
[...]

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


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?

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.
 
M

Mike Wahler

David B. Held said:
Mike Wahler said:
[...]
However, many here (including myself) will be happy
to help this person. Looks like you're chasing him
away. How come?

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.

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
 
G

Gregg

Stan writes:
[...]

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.

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 */
 
W

WW

David said:
Mike Wahler said:
[...]
However, many here (including myself) will be happy
to help this person. Looks like you're chasing him
away. How come?

Because of my loyalty to the newsgroup fuhrer. Heil Fehrer!
Death to noobs! Ok, just kidding. It seems that Attila has

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.
 
D

David B. Held

WW said:
David said:
[...]
Because of my loyalty to the newsgroup fuhrer. Heil
Fehrer! Death to noobs! Ok, just kidding.

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 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.
So I think it is time for you to apologize!

You mean it's time for you to censor me.
Calling someone a nazi is *not* a joke, in any way.

It is when "Nazi" is a placeholder for "authoritarian 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).
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!

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.
And this is not a joke either.

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 "progressive"
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
 
S

sam

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?

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

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 ???
 
C

Christopher Benson-Manica

lilburne said:
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.

Um, yikes? Although it was quite awhile after my first C course before I
really figured out what make was all about. Of course, that might have been
because they just gave us hugely complex makefiles and never told us how to
use them...
 
W

WW

David said:
WW said:
David said:
[...]
Because of my loyalty to the newsgroup fuhrer. Heil
Fehrer! Death to noobs! Ok, just kidding.

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 in order to be offended, you have to rely on speculative
ancestry?

No. That only adds to my disqust. Now apologize or shut up. You have
crossed the line. No big mouthed bullshit talk will take you out of this.
 
L

lilburne

Christopher said:
Um, yikes? Although it was quite awhile after my first C course before I
really figured out what make was all about. Of course, that might have been
because they just gave us hugely complex makefiles and never told us how to
use them...

You can get a comp sci degree by drawing ER diagrams
(probably UML nowadays). You only need rudimentary
programming knowledge if at all.
 
J

jeffc

David B. Held said:
You mean it's time for you to censor me.

It would be better if you would filter him. I did, and life is more
pleasant now.

Actually, by convention when it has a lower case 'n', it *is* used as a
joke. Seinfeld's soup nazi, anyone?
 
M

Mike Wahler

Christopher Benson-Manica said:
Um, yikes? Although it was quite awhile after my first C course before I
really figured out what make was all about. Of course, that might have been
because they just gave us hugely complex makefiles and never told us how to
use them...

'make' utilites are not part of C, although often used
as development tools with projects containing C programs.

'make' utilites need not be used with programming at all.
They simply implement 'rule based' batch processing.
I sometimes use them for things besides building programs.

I frequently see this failure to distinguish concepts by
CS students (and graduates!). Sigh.

-Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top