[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
Pete's QBASIC Site Discuss QBasic, Freebasic, QB64 and more 2006-11-03T01:30:55-05:00 http://petesqbsite.com/phpBB3/app.php/feed/topic/1768 2006-11-03T01:30:55-05:00 2006-11-03T01:30:55-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=13101#p13101 <![CDATA[HELP! calculating student's average]]>


'Filename: KTDOFOR.BAS
'
'Variable Dictionary
' numcourses - the total number of courses the student took
' total - a running total of all the student's marks
' mark - a mark in one course
' counter - a counter to keep track of the number of times a message
' is printed
' average - the average of all the students marks
'
CLS
PRINT "This program will determine your average on last year's courses"
PRINT "When you have finished entering marks, type a negative number."
PRINT

numcourses = 0
total = 0

DO
'This section makes sure a valid mark is entered
'
DO
CLS
LOCATE 2, 1
INPUT "Please enter a mark ", mark
LOOP UNTIL mark <= 100 AND mark >= 0
tmp = mark

'Increment total and counter
'
numcourses = numcourses + 1
total = total + mark

'Special message for a high mark
'

DO WHILE mark >= 90
counter = 0
PRINT
DO
PRINT "A mark of"; mark; "! Wow!"
counter = counter + 1
LOOP UNTIL counter = 10
Counter = 0
PRINT "Press a key to enter next mark"
PRINT
SLEEP
WHILE LEN(INKEY$): WEND
EXIT DO
LOOP

LOOP WHILE (tmp > 0)

'Make sure at least one mark was entered
'
DO WHILE numcourses > 0
average = total / numcourses

'Special message for a high average
'
DO WHILE average > 90
counter = 15
WHILE counter > 4
counter = counter - 1
PRINT "Wow a mark of"; average; "Holy Cow!"
WEND
EXIT DO
LOOP
DO WHILE average < 90
CLS
PRINT "Your average last year was"; average
EXIT DO
LOOP

DO WHILE average = 0
CLS
PRINT "No marks were entered"
EXIT DO
LOOP
EXIT DO
LOOP





END

Statistics: Posted by Bulldog — Fri Nov 03, 2006 1:30 am


]]>
2006-11-01T17:47:19-05:00 2006-11-01T17:47:19-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=13091#p13091 <![CDATA[HELP! calculating student's average]]>
Yeah, but like many others, he hasn't come back to acknowledge the help given nor anything.
Or he visited here before Sun Oct 01, 2006 1:11 am and is now too scared :wink:

Code:

 WHILE 90 < average <= 100 
So while 90 is smaller than average that is hundred or less? :lol:
Never seen anything like that. I hope jasonkidd007 comes back and tells what he means (or tried to mean) with that one.

Statistics: Posted by bungytheworm — Wed Nov 01, 2006 5:47 pm


]]>
2006-11-01T17:03:02-05:00 2006-11-01T17:03:02-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=13090#p13090 <![CDATA[Re: HELP! calculating student's average]]>
WHILE 90 < average <= 100
This is really strange syntax to me, and I've been programming Basic for over 30 years. I compiled your code and got no error, but I don't understand what this statement means.
Hmm... It doesn't seem like this would work. Usually $$$ like this will require an AND statement. WHILE 90<average AND average <=100 is usually what it would be. The only use I could think of for this is detecting if the grade went over 100 somehow or became too low (below 90). I'll have to look into this!

Statistics: Posted by Patz QuickBASIC Creations — Wed Nov 01, 2006 5:03 pm


]]>
2006-10-05T20:12:44-05:00 2006-10-05T20:12:44-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=12872#p12872 <![CDATA[HELP! calculating student's average]]>
Yeah, but like many others, he hasn't come back to acknowledge the help given nor anything.

*****
What a surprise...
But yeah, I was harsher than needed, because I forgot to check his postcount. This guy actually has one, and so I should just have left the topic without posting at all. My bad.
Not to worry. You're kind of post helps to clear the air, and keeps them on their toes.

*****

Statistics: Posted by moneo — Thu Oct 05, 2006 8:12 pm


]]>
2006-10-05T06:04:49-05:00 2006-10-05T06:04:49-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=12867#p12867 <![CDATA[HELP! calculating student's average]]>
Yeah, but like many others, he hasn't come back to acknowledge the help given nor anything.

*****
What a surprise...
But yeah, I was harsher than needed, because I forgot to check his postcount. This guy actually has one, and so I should just have left the topic without posting at all. My bad.

Statistics: Posted by Z!re — Thu Oct 05, 2006 6:04 am


]]>
2006-10-04T22:11:40-05:00 2006-10-04T22:11:40-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=12865#p12865 <![CDATA[HELP! calculating student's average]]>
*****

Statistics: Posted by moneo — Wed Oct 04, 2006 10:11 pm


]]>
2006-10-03T20:44:10-05:00 2006-10-03T20:44:10-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=12863#p12863 <![CDATA[HELP! calculating student's average]]>
Pete, thanks for posting your position on homework. I totally agree with you. That's why I went ahead and tried to help him.

Regards..... Moneo
i agree thanks for helping him moneo...

he did make an effort... he just didnt make a blank
question asking for help or a weak 3-4 line attempt
at something....

Statistics: Posted by sid6.7 — Tue Oct 03, 2006 8:44 pm


]]>
2006-10-03T19:10:36-05:00 2006-10-03T19:10:36-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=12861#p12861 <![CDATA[HELP! calculating student's average]]>
Regards..... Moneo

Statistics: Posted by moneo — Tue Oct 03, 2006 7:10 pm


]]>
2006-10-01T20:56:56-05:00 2006-10-01T20:56:56-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=12845#p12845 <![CDATA[HELP! calculating student's average]]>
Moneo: thanks for helping him out.

Statistics: Posted by Pete — Sun Oct 01, 2006 8:56 pm


]]>
2006-10-01T20:00:07-05:00 2006-10-01T20:00:07-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=12844#p12844 <![CDATA[HELP! calculating student's average]]>
.....
I'm afraid of Z!re. :wink:
Nathan, you're not only witty, but you also have a great sense of humor.

*****

Statistics: Posted by moneo — Sun Oct 01, 2006 8:00 pm


]]>
2006-10-01T11:45:47-05:00 2006-10-01T11:45:47-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=12841#p12841 <![CDATA[HELP! calculating student's average]]>
Hey guys, I think we were a bit too rough on Jason. Yes, I agree, the post is about homework. However, he's not asking us to do the homework, he's just asking for a little help to fix it up. He also posted a pretty nice program so we can see that he's well ahead on doing the homework.

Give the kid a break!

*****
I'm afraid of Z!re. :wink:

Statistics: Posted by {Nathan} — Sun Oct 01, 2006 11:45 am


]]>
2006-09-30T18:58:33-05:00 2006-09-30T18:58:33-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=12837#p12837 <![CDATA[Re: HELP! calculating student's average]]>
......
The program is almost done, i just need professional help to perfect it.
Actually, you program looks good, but has a lot of problems, especially with the nested WHILE/WENDs.

One problem with WHILE/WENDs is that there is no EXIT WHILE. So try to use DO/LOOPs instead where you can get out with an EXIT DO.

Another alternative to your nested WHILE/WENDs is SELECT CASE. Have you used that yet?

By the way, you said you can't use IF, but you used two of them.

PRINT "Wow a mark of"; average; "Holy Cow!"
The reason this message prints in an infinite loop is because it takes the exit out of the WHILE/WEND when counter is >4, it later hits the WEND at the bottom of the program, loops back up to "WHILE numcourses > 0" and starts the counter at 15 all over again.

The last 2 WHILE/WENDs, where you set counter=1 and then loop WHILE counter=1, puts the program into an infinite loop also. What you want here is to get out (finish). Just do a SYSTEM or an END.

WHILE 90 < average <= 100
This is really strange syntax to me, and I've been programming Basic for over 30 years. I compiled your code and got no error, but I don't understand what this statement means.

Good luck.

*****

Statistics: Posted by moneo — Sat Sep 30, 2006 6:58 pm


]]>
2006-09-30T18:11:22-05:00 2006-09-30T18:11:22-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=12836#p12836 <![CDATA[HELP! calculating student's average]]>
Give the kid a break!

*****

Statistics: Posted by moneo — Sat Sep 30, 2006 6:11 pm


]]>
2006-09-27T05:35:04-05:00 2006-09-27T05:35:04-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=12815#p12815 <![CDATA[HELP! calculating student's average]]>
We hate people that ask us to do their homework for them. After all, there ARE over 600 tutorials on this website.

Statistics: Posted by {Nathan} — Wed Sep 27, 2006 5:35 am


]]>
2006-09-27T04:11:25-05:00 2006-09-27T04:11:25-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=12810#p12810 <![CDATA[HELP! calculating student's average]]> And get your fork homework off our forum!

Statistics: Posted by Z!re — Wed Sep 27, 2006 4:11 am


]]>