472,983 Members | 2,305 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,983 software developers and data experts.

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.
Jul 19 '05 #1
22 2034

"Stan" <st******@netzero.net> wrote in message
news:82*************************@posting.google.co m...
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
Jul 19 '05 #2
"Stan" <st******@netzero.net> wrote in message
news:82*************************@posting.google.co m...
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

---
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
Jul 19 '05 #3

"David B. Held" <dh***@codelogicconsulting.com> wrote in message
news:bm**********@news.astound.net...
"Stan" <st******@netzero.net> wrote in message
news:82*************************@posting.google.co m...
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
Jul 19 '05 #4
"David B. Held" <dh***@codelogicconsulting.com> wrote in message
news:bm**********@news.astound.net...
"Stan" <st******@netzero.net> wrote in message
news:82*************************@posting.google.co m...
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

Jul 19 '05 #5
Stan writes:
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.

Jul 19 '05 #6
"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:Gq*****************@newsread3.news.pas.earthl ink.net...
[...]
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

---
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
Jul 19 '05 #7
"David White" <no.email@provided> wrote in message
news:YF******************@nasal.pacific.net.au...
[...]
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

---
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
Jul 19 '05 #8

"David B. Held" <dh***@codelogicconsulting.com> wrote in message
news:bm**********@news.astound.net...
"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:Gq*****************@newsread3.news.pas.earthl ink.net...
[...]
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.
Jul 19 '05 #9
Mike Wahler wrote:
"David B. Held" <dh***@codelogicconsulting.com> wrote in message
news:bm**********@news.astound.net...
"Stan" <st******@netzero.net> wrote in message
news:82*************************@posting.google. com...
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.

Jul 19 '05 #10
"David B. Held" <dh***@codelogicconsulting.com> wrote in message
news:bm**********@news.astound.net...
"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:Gq*****************@newsread3.news.pas.earthl ink.net...
[...]
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
Jul 19 '05 #11
"osmium" <r1********@comcast.net> wrote in news:bmjhqj$nklg1$1@ID-
179017.news.uni-berlin.de:
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 */

--
Gregg
Jul 19 '05 #12
WW
David B. Held wrote:
"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:Gq*****************@newsread3.news.pas.earthl ink.net...
[...]
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.

--
WW aka Attila
Jul 19 '05 #13
"WW" <wo***@freemail.hu> wrote in message
news:bm**********@phys-news1.kolumbus.fi...
David B. Held wrote:
[...]
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

---
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
Jul 19 '05 #14
sam

"David B. Held" <dh***@codelogicconsulting.com> wrote in message
news:bm**********@news.astound.net...
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 ???
Jul 19 '05 #15
lilburne <li******@godzilla.net> spoke thus:
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...

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 19 '05 #16
WW
David B. Held wrote:
"WW" <wo***@freemail.hu> wrote in message
news:bm**********@phys-news1.kolumbus.fi...
David B. Held wrote:
[...]
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.

--
WW aka Attila
Jul 19 '05 #17

"David B. Held" <dh***@codelogicconsulting.com> wrote in message
news:bm**********@news.astound.net...
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.
Calling someone a nazi is *not* a joke, in any way.


Actually, by convention when it has a lower case 'n', it *is* used as a
joke. Seinfeld's soup nazi, anyone?
Jul 19 '05 #18
Christopher Benson-Manica wrote:
lilburne <li******@godzilla.net> spoke thus:

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


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

Jul 19 '05 #19
"Christopher Benson-Manica" <at***@nospam.cyberspace.org> wrote in message
news:bm**********@chessie.cirr.com...
lilburne <li******@godzilla.net> spoke thus:
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...


'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
Jul 19 '05 #20
Mike Wahler <mk******@mkwahler.net> spoke thus:
'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.


Believe me, I do know that C and C++ are not directly linked with make. I
just made the comment because make "makes" life much simpler for writing
projects of a reasonable size. (Was that a bad pun or what??). make is a
tool that programmers should know how to use (IMHO), but we didn't really
learn it. Believe me, I'm not trying to give you ulcers ;)

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 19 '05 #21

"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:fG***************@newsread4.news.pas.earthlin k.net...
"Christopher Benson-Manica" <at***@nospam.cyberspace.org> wrote in message
news:bm**********@chessie.cirr.com...
lilburne <li******@godzilla.net> spoke thus:
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...


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


He didn't fail to distinguish <sigh>. make files are no more a "part of C"
than "dot aich files" are.
Jul 19 '05 #22
"sam" <sa*@cvisiontech.com> wrote in message
news:wd**********************@twister.nyc.rr.com.. .

"David B. Held" <dh***@codelogicconsulting.com> wrote in message
news:bm**********@news.astound.net...
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 ?


That's not what I said. You should take the *event* personally.
But relating every word uttered by every person as a statement
justifying that event is unreasonable.
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...


You get a word, with an entry in the dictionary for an event
that happened to your ancestors, and that isn't enough?
Here's the entry from dictionary.com, which in this case is
channeling The American Heritage Dictionary:

1. Great destruction resulting in the extensive loss
of life, especially by fire.

2.
a. Holocaust The genocide of European Jews and
others by the Nazis during World War II: “Israel
emerged from the Holocaust and is defined in relation
to that catastrophe” (Emanuel Litvinoff).

b. A massive slaughter: “an important document in
the so-far sketchy annals of the Cambodian
holocaust” (Rod Nordland).

3. A sacrificial offering that is consumed entirely by flames.

Note that the millions of Gentiles killed at or around the
same time get reduced to "others". Was their sacrifice
any less? Isn't it enough that your ancestors get singled
out for attention here? My point is that Slavs and Poles
and all the rest killed during WWII don't assume that
every reference to nazis justifies the Holocaust or any
other atrocity in history. And they lost just as many if not
more family members as any Jew.
and a state ? what kind of a state is it when terrorists are
blowing people up all the time ???


It's more of a state than the Palestinians have, for one. Are
you grateful for nothing?? But that's getting afar field. The
point is, I was not trying to make light of any atrocity in history,
nor to accuse someone of being a genocidal maniac. I was
merely equating Atilla with tyrrany, and I suspect I'm not the
only person who feels that way. His latest actions merely
reinforce that opinion.

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
Jul 19 '05 #23

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Kirk Bevins | last post by:
Hello, new to posting, got a dilema in c++. I cant seem to create new instances of my student class. The idea is to make a database where the user inputs surnames and library card numbers etc. The...
4
by: Angus Comber | last post by:
Hello I have received a lot of help on my little project here. Many thanks. I have a struct with a string and a long member. I have worked out how to qsort the struct on both members. I can...
18
by: Tony Burrows | last post by:
I'm just learning C as another language, and I'm trying to build some utilities into a library. I have this (crude I know) function: void insert(char* insrt, char* source, int place){ char...
2
by: sallyk07 | last post by:
Modify the Student class so that each student object should also contain the scores for three tests. Provide a constructor that sets all instance values based on parameter values. Overload the...
10
by: arnuld | last post by:
thanks
0
by: yjh0914 | last post by:
hi guys! so im basically editting my post i made earlier as it wznt as specific.. i have to make a program that basically ranks students by their cumulative gpa. the student's info is on a csv file...
31
by: huili80 | last post by:
Say I have two classes: class A { public: int x; }; class B {
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.