Qbasicnews.com

QBasic => QB Discussion & Programming Help => Topic started by: JJRJRM143 on January 19, 2004, 02:48:14 PM



Title: Accumulator Problem
Post by: JJRJRM143 on January 19, 2004, 02:48:14 PM
Ok I have most of the program done but I can't figure out where to insert my accumulators for gender. It should be like

tot.male = tot.male + male and
tot.female = tot.female + female

Code:

GOSUB Start
GOSUB Process
GOSUB Finish
END

Start:
PRINT "                               NORWOOD HIGH SCHOOL"
PRINT "                              ROOM ASSIGNMENT REPORT"
PRINT "                              ======================"
PRINT
PRINT
PRINT "Room               Student"
PRINT
D1$ = "\   \           \               \"
T1$ = "Male Students = #"
T2$ = "Female Students = #"
T3$ = "Total Students For Room = #"
T4$ = "Total Male Students = ##"
T5$ = "Total Female Students = ##"
T6$ = "Total Students = ##"
READ room$, name$, gender$
hold.room$ = room$
RETURN

Process:
DO UNTIL room$ = "EOF"
  IF hold.room$ = room$ THEN
    IF gender$ = "M" THEN
      male = male + 1
    ELSE
      female = female + 1
    END IF
    count = count + 1
    PRINT USING D1$; room$; name$
  ELSE
    PRINT USING T1$; male
    PRINT USING T2$; female
    PRINT USING T3$; count
    PRINT
    count = 0
    male = 0
    female = 0
    hold.room$ = room$
    PRINT USING D1$; room$; name$
    count = count + 1
    male = male + 1
  END IF
  tot.count = tot.count + 1
  READ room$, name$, gender$
LOOP
RETURN

Finish:
PRINT USING T1$; male
PRINT USING T2$; female
PRINT USING T3$; count
PRINT
PRINT USING T4$; tot.male                
PRINT USING T5$; tot.female
PRINT USING T6$; tot.count
RETURN





DATA 101, Joseph Bishop, M
DATA 101, Paul Burke, M
DATA 101, Marge Hackett, F
DATA 101, Beth Foster, F
DATA 101, Julia Jefferson, F
DATA 101, Daniel Munn, M
DATA 101, Barbara Tipton, F
DATA 202, Patrick Collins, M
DATA 202, Kyle Durkee, M
DATA 202, Brian Luire, M
DATA 202, Miguel Perez, M
DATA 202, Nancy Symans, F
DATA 202, George Fassio, M
DATA 303, Charles Howard, M
DATA 303, Virginia Murray, F
DATA 303, Carol Palm, F
DATA 303, Daniel Thomas, M
DATA 303, Carl Tross, M
DATA 303, Lindsey West, F
DATA 303, Stephanie Wyatt, F
DATA EOF,,


Your help is greatly appreciated


Title: Accumulator Problem
Post by: Z!re on January 19, 2004, 02:53:57 PM
Maybe you should try a little harder before asking for homework help?

Just a suggestion:

Quote

IF gender$ = "M" THEN
male = male + 1


Look there.

And do your own damn homework. *argh!*

 :rotfl:


Title: Accumulator Problem
Post by: JJRJRM143 on January 19, 2004, 03:02:21 PM
Damn Z!re, someone woke up on the wrong side this morning.

I case you did'nt understand I'm trying to total up the male and female students and add them at the end. Those lines you pointed out are just fine

Ya crabby bastard


Title: Accumulator Problem
Post by: Zack on January 19, 2004, 03:04:51 PM
...We just have a policy here of trying to get people to do their own homework, or else they won't learn anything, and the QB teacher's efforts will go to waste.
Don't flame.


Title: Accumulator Problem
Post by: Plasma on January 19, 2004, 03:11:39 PM
Quote from: "JJRJRM143"
Damn Z!re, someone woke up on the wrong side this morning.

I case you did'nt understand I'm trying to total up the male and female students and add them at the end. Those lines you pointed out are just fine

Ya crabby bastard


If you had half a brain, you would know that he was giving you a hint. And if you want people to help you, calling them names probably won't get you off to a very good start.


Title: Accumulator Problem
Post by: Z!re on January 19, 2004, 03:30:51 PM
Also, note the smiley " :rotfl: " I was making a joke, relax.

It is a simple problem, to me it looks like you took a quick peek and then decided to go watch Tv instead and let us do it for you.

The code you posted is copied right off the assignment.

You have not made any changes to it (that I can see anyways)

We will NOT do your homework, we WILL help you all we can, but ask a question on your work so far.

I know the lines i pointed out was fine, but you should listen more in class you "crabby bastard", and stop watching TV, drinking bear, having sex, playing sports.

My advice: become a monk.. or Stare into a wall, it would do you good  :rotfl:

Code:

IF you = offended THEN iWasMakingaJoke=TRUE:doYourOwnHomework = TRUE ELSE doYourOwnHomework = TRUE


Title: Accumulator Problem
Post by: stevie on January 19, 2004, 03:32:50 PM
personally, I think this guy did it right: He posted what he had and he asked for help on a specific part. Z!ire was very much in the wrong. Granted, the newb shooting back with an insult probably wasn't a great move either but I can't say that I wouldn't have done the same in his position.

BTW -- at first glance it looks like you might be resetting all your count variables within the loop, which means no matter how many times you add 1 to it, it's going back to 0 when it reaches those lines.


Title: Accumulator Problem
Post by: Z!re on January 19, 2004, 03:44:58 PM
Quote from: "stevie"
Z!ire was very much in the wrong.lines.


I know the assignment:
you get the exact same code JJRJRM143
the assignment:

add tot.males and tot.females and make it display those values at the end of the program

Now. Please tell me what he wanted help with?

Ohh and by the way stevie, I have an english essay, heres what I have:

Once upon a time.

I have to make it a A+ essay until tomorrow, can you please help me?

No offense intended, just making my point.  8)


Title: Accumulator Problem
Post by: Diroga on January 19, 2004, 03:46:28 PM
you should be thankful that you have a qb class. i dont... :(


Title: Accumulator Problem
Post by: Zack on January 19, 2004, 03:48:10 PM
You should be thankful you have *any* computers/programming course - I don't have any.
People obviously think that only those above the age of 14 are worthy to study programming. :roll:


Title: Accumulator Problem
Post by: stevie on January 19, 2004, 04:13:16 PM
Z!RE -- fair enough, I didn't realize that all the code he pasted was supplied to him.


Title: Accumulator Problem
Post by: JJRJRM143 on January 19, 2004, 04:51:42 PM
First off, let me start by saying that I did not in any way just copy & paste this code. I coded the entire thing last night. What I got from my teacher was a paper stating the DATA and the format he wanted it displayed in. So it pissed me off even more to see Z!re saying that he knew for a fact that I copied it and did'nt do a thing. I take my programming class very seriously as this is what I want to do for a living. So Z!re make sure you know exactly what you're talking about before you go off shooting your mouth

Second, I fixed it on my own

Code:

GOSUB Start
GOSUB Process
GOSUB Finish
END

Start:
PRINT "                               NORWOOD HIGH SCHOOL"
PRINT "                              ROOM ASSIGNMENT REPORT"
PRINT "                              ======================"
PRINT
PRINT "Room                Student"
PRINT
D1$ = "\   \           \               \"
T1$ = "Male Students = #"
T2$ = "Female Students = #"
T3$ = "Total Students For Room \ \ = #"
T4$ = "Total Male Students = ##"
T5$ = "Total Female Students = ##"
T6$ = "Total Students = ##"
READ room$, name$, gender$
hold.room$ = room$
RETURN

Process:
DO UNTIL room$ = "EOF"
  IF hold.room$ = room$ THEN
    IF gender$ = "M" THEN
      male = male + 1
      tot.male = tot.male + 1
    ELSE
      female = female + 1
      tot.female = tot.female + 1
    END IF
    old.room$ = room$
    count = count + 1
    PRINT USING D1$; room$; name$
  ELSE
    PRINT USING T1$; male
    PRINT USING T2$; female
    PRINT USING T3$; old.room$; count
    PRINT
    count = 0
    male = 0
    female = 0
    hold.room$ = room$
    PRINT USING D1$; room$; name$
    count = count + 1
    male = male + 1
    tot.male = tot.male + 1
  END IF
  tot.count = tot.count + 1
  READ room$, name$, gender$
LOOP
RETURN

Finish:
PRINT USING T1$; male
PRINT USING T2$; female
PRINT USING T3$; old.room$; count
PRINT
PRINT "==========================="
PRINT USING T4$; tot.male
PRINT USING T5$; tot.female
PRINT USING T6$; tot.count
PRINT "==========================="
RETURN





DATA 101, Joseph Bishop, M
DATA 101, Paul Burke, M
DATA 101, Marge Hackett, F
DATA 101, Beth Foster, F
DATA 101, Julia Jefferson, F
DATA 101, Daniel Munn, M
DATA 101, Barbara Tipton, F
DATA 202, Patrick Collins, M
DATA 202, Kyle Durkee, M
DATA 202, Brian Luire, M
DATA 202, Miguel Perez, M
DATA 202, Nancy Symans, F
DATA 202, George Fassio, M
DATA 303, Charles Howard, M
DATA 303, Virginia Murray, F
DATA 303, Carol Palm, F
DATA 303, Daniel Thomas, M
DATA 303, Carl Tross, M
DATA 303, Lindsey West, F
DATA 303, Stephanie Wyatt, F
DATA EOF,,


And thanks for sticking up for me stevie, I code a prog and just because I can't figure 1 thing out and come here for help as this is a QBasic board ppl jump down my throat, screw this, I'll just stick to my regular board I goto even though they are not as experienced with QBasic as you guys are

*peace out and thanks to those who actually helped*


Title: Accumulator Problem
Post by: Agamemnus on January 19, 2004, 04:58:24 PM
Whoah. I think that the moral of the story is: "Even when hungry, the fox should not steal the chicken when the farmer is looking."


Title: Accumulator Problem
Post by: stevie on January 19, 2004, 05:19:14 PM
JJ: Sorry for doubting you

Z!re: lying to make your point makes you look like a toolbox.

I rescind my apology.


Title: Accumulator Problem
Post by: Z!re on January 19, 2004, 06:25:52 PM
Seriously, I don't care, I just wanted to help JJRJRM143 out by giving a hint to a code (which IF he had coded it himself) would have been simple to fix, and if he takes hes programming course seriously it wouldn't be a problem, as the teacher or hes book explains how to do it (I am sure of it, teachers do not give unsolvable assigments, ey  :wink: )

The code contains stuff that makes atleast me doubt that JJRJRM143 coded it himself and then had trouble adding a tot.n counter.

I never intended any offense by my posts, so why do you jump at me?

It was he who insulted me not the other way around.


Title: Accumulator Problem
Post by: stevie on January 19, 2004, 06:47:50 PM
I disagree, but instead of making this a flamewar, we'll just let it go.


Title: Accumulator Problem
Post by: Zack on January 19, 2004, 08:22:52 PM
Agreed, Stevie...
Everybody: Cool it!


Title: Accumulator Problem
Post by: Fling-master on January 19, 2004, 09:48:41 PM
Yes... I agree with Zack however I would like to make a little revision...

Everybody: You will cool it!

(Seriously)

:P


Title: Accumulator Problem
Post by: Diroga on January 19, 2004, 11:41:12 PM
http://forum.basicnetwork.net/viewtopic.php?t=98&sid=f099f25f0f73dbd9d762f4c1ec703f46
 :???:


Title: Accumulator Problem
Post by: Z!re on January 20, 2004, 09:08:50 AM
Just letting off steam  :lol:

Nothing personal  :P

But I agree, let's drop this matter,  I don't care if I was right or wrong.

I was trying to help JJRJRM143 by giving a hint and he insults me, fair enough, I point out that it possibly (in my opinion, you may or may not dissagree, it's not the point) is a homework assignment as I recognize it.

JJRJRM143 comes back with the fixed code, the code is fixed the way I hinted, yet, JJRJRM143 still don't thank me or anyone (except stevie)

Now, why am I the bad guy? I might be the most evil programmer on the face of earth, but what have I done to show that?

I am sorry if I made personal insults to anyone here, I really am. But don't jump on me for nothing, JJRJRM143 insults me and you all back him up because he claims I lie?

If I was a student wanting to cheat in class, and I posted my assignment here and some "jerk" (me  :lol: ) said I was posting an assignment and noone would help me. Then offcourse I would claim it to be my own doing, and try to do everything to get help, even pit the "regulars" on each other.

But that's just me, and I don't even have a BASIC class (only C/C++  :cry: )

My first post containing the sentences:
"Maybe you should try a little harder before asking for homework help? "
and
"And do your own damn homework. *argh!* "

Was mostly intended as a joke, something to ease the mood, IF JJRJRM143 would have coded the entire thing himself I he wouldn't mind, I mean, if someone accuses me of being gay (for example) I don't mind, cause I know I have a girlfriend. And you are just a bunch of people on the internet.

So relax folks, I don't care, all I care about was that you trust JJRJRM143 more than me because you pitty him, and maybee he deserves that pitty, I don't know, I don't care.

CLOSE #1

And eat my damn shoe! :rotfl: (ease up)


Title: Accumulator Problem
Post by: stevie on January 20, 2004, 11:00:32 AM
hmmm...this thread policed itself -- why get all strongarm-y?


Title: Help with homework...
Post by: dadsherm on January 20, 2004, 12:59:02 PM
I really feel sorry for you kids.
If you would take the time to answer a question WITHOUT the use of profanity, it would help to set the tone of your reply much better.
As for if the student copied down the homework or not, is not for anyone to say, but the student. And if it was copied, they are only hurting themselves.
If you are wondering why I said "kids", it's for two reasons:

First : Some of you say "let's drop it", and then continue to try to get in the last word,

Second: I'm probably older than most, if not all, of you. So what I write, I write from experience.
Nobody cares if you have the last word or not, but they DO care about how you treat them.
I don't know if we just lost a future programmer or not because of what some of you had to say, but for their sake, and for the sake of this forum, I hope not.


Title: Accumulator Problem
Post by: Z!re on January 20, 2004, 01:45:23 PM
Last word

*run's away to hide from dadsherm*  :P

Lol, this thread has gone completely off-topic  :bounce:

So anyways, what did you guys have for dinner on the 1st of January?


Title: Accumulator Problem
Post by: stevie on January 20, 2004, 02:04:17 PM
dadsherm: you're perpetuating the thread. What you have done is successfully incite and insult other people in the thread by doign the very things you cited as childish. It doesn't matter. I won't reply to another thing in this thread, and fling-master can respond to my message to him via PM if he likes -- or not at all, I was just curious anyway.


Title: Accumulator Problem
Post by: Fling-master on January 20, 2004, 04:58:02 PM
Enough! Keep this on topic and stop your petty bickering!


Title: Accumulator Problem
Post by: adosorken on January 20, 2004, 08:18:47 PM
Quote from: "Fling-master"
Everybody: You will cool it!

You tell 'em Fling ;)


Title: Accumulator Problem
Post by: Fling-master on January 20, 2004, 09:46:18 PM
Damn straight!


Title: Accumulator Problem
Post by: Mech1031 on January 21, 2004, 11:53:33 PM
you should all listen to dadsherm, he's wiser beyond your years.  at the rate you guys go with all of these threads, qbnews will be alive for the soul purpose of getting the last word in.  thats not what this community is about, this community is about helping others with their coding problems and showing off your QB stuff.  if you guys don't stop squabbling (especially the newbs) then this place will go under again.  i don't want this to be a qbasic.com, i want this to be better...


Title: Accumulator Problem
Post by: TheBigBasicQ on January 22, 2004, 05:34:42 AM
*ahem* about qbasic.com, it's forum is thriving with newbies and oldies as well. The only thing that is wrong with it is, its not being updated by the owner =P. And I too agree with Z!re. It has always been the policy of the qmunity that no one is going to help with homework assignments. It's not going to help the person asking for help on his/her homework. It is also my policy as well.

If you feel that someone wants help on some homework you should hint him or point in the correct direction. Nobody is asking you to fix the program or write the whole program. Just give some pseudo code or algorithm or you can always ignore the thread =P. At the end of the day you can't expect the newbie to dream up things that he doesn't know. Guidance is always helpful ;)


Title: Accumulator Problem
Post by: Mech1031 on January 22, 2004, 02:51:00 PM
you my freind, just did what you said was unethical.  you stated that "you should ignore the thread", yet you still posted just to get the last post.  read dadsherms post, then decide to reply to this or not.


Title: Accumulator Problem
Post by: TheBigBasicQ on January 22, 2004, 03:10:56 PM
You failed to get my point. I wasn't trying to get the last word. I was merely stating my view on this highly debated subject. And I didnt say that you *must* ignore the post. It was just *one* of the options. Since, the original poster solved his problem i had nothing to offer him. But I had an opinion about the discussion that was going on so I presented it to you.

Next time read others' posts carefully before you use/call them using strong words such as 'unethical'.


Title: Accumulator Problem
Post by: Fling-master on January 22, 2004, 03:48:29 PM
Quote from: "Fling-master"
Enough! Keep this on topic and stop your petty bickering!


What did you guys not understand about that?


Title: Accumulator Problem
Post by: Agamemnus on January 22, 2004, 03:50:31 PM
Well, you're all wrong.

I am getting the last word. Or at least the second to last word.

*waits*


Title: Accumulator Problem
Post by: Z!re on January 22, 2004, 07:41:02 PM
Fling, it is a cool topic, no insulting, no flaming, just a topic off-topic, the original poster never returned, and probably never will. So i dont know. The topic changed to that of halping people with their homework or not.

And Mech1031, why do you sp desperately want the last word? *just joking*

Who cares, it's a dead off-topic thread anyways  :bounce:

And you still haven't answered my question about what you had for dinner on january 1st


Title: Accumulator Problem
Post by: Fling-master on January 22, 2004, 07:50:34 PM
Yeah this hasn't turned into flaming or anything. However, the "Newbie Help" forum is obviously not the place for this kind of a discussion.