Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

anyone know qbasic here?

Thread Tools
 
Search this Thread
 
Old 11 June 2002, 01:59 PM
  #1  
HKSubaru
Scooby Senior
Thread Starter
 
HKSubaru's Avatar
 
Join Date: Apr 2002
Posts: 11,251
Likes: 0
Received 0 Likes on 0 Posts
Post

i am doing a test and need to find ten misatakes! HELP! i will post £10 cheque to whoever does it for me!
Old 11 June 2002, 02:00 PM
  #2  
HKSubaru
Scooby Senior
Thread Starter
 
HKSubaru's Avatar
 
Join Date: Apr 2002
Posts: 11,251
Likes: 0
Received 0 Likes on 0 Posts
Post

REM PLEASE WRITE YOUR NAME HERE:........
REM THERE ARE NO MISTAKES IN COMMENTS.
REM THERE ARE NO MISTAKES IN VARIABLE NAMES.
REM ONLY HAND IN HAND WRITTEN CORRECTIONS ON THIS SHEET.
REM THERE ARE TEN MISTAKES TO FIND.
REM PUT A SINGLE LINE THROUGH THE CODING THAT IS WRONG.
REM WRITE THE CORRECT CODING IN THE BLANK LINE BELOW THE ERROR.
REM THE PROGRAM WILL PRINT OUT THE SUM (x+y) AND PRODUCT (x*y)
REM OF THE 25 PAIRS OF NUMBERS FROM 1 & 1 TO 5 & 5.
TOTAL = 0
LABEL:

CLS

INPUT "PLEASE PRESS S TO START OR X TO EXIT "; N$

IF ASC(N$) = 0 GOTO LABEL1 'WORK OUT THE LENGTH

DO WHILE UPPER(N$) <> "X" 'ONLY LOOP WHEN A NAME IS ENTERED I.E. MORE THAN 0 CHARACTERS ENTERED

FOR X = 1 TO 7 'FIRST LOOP

FOR Y = 1 TO 7 'SECOND LOOP

PRINT "x = "; X;

PRINT " Y = "; Y;

Z = X + Y

PRINT " X + Y = "; X + Y;

ZZ = X * Y

PRINT " X * Y = "; X * Y

TOTAL = TOTAL + ZZ

LOOP

NEXT X

NEXT Y

PRINT " TOTAL "

INPUT "PLEASE PRESS S TO START OR X TO EXIT"; N$

REM PLEASE WRITE DOWN THE VALUE OF "TOTAL" WHICH APPEARS ON SCREEN AT THE END OF THE PROGRAM

END

Old 11 June 2002, 02:06 PM
  #3  
HKSubaru
Scooby Senior
Thread Starter
 
HKSubaru's Avatar
 
Join Date: Apr 2002
Posts: 11,251
Likes: 0
Received 0 Likes on 0 Posts
Post

Output
x=1 y=1 x+y=2 x*y=1
x=1 y=2 x+y=3 x*y=2

.....
x=5 y=5 x+y=10 x*y=25
Old 11 June 2002, 02:12 PM
  #4  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

label: - Label1:

Upper = UCase$
Asc = Len

Edited cos paste didnt work..
and cos I wrote the wrong things...

[Edited by David_Wallis - 6/11/2002 2:20:27 PM]

[Edited by David_Wallis - 6/11/2002 2:43:31 PM]
Old 11 June 2002, 03:21 PM
  #5  
dsmith
Scooby Regular
 
dsmith's Avatar
 
Join Date: Mar 1999
Posts: 4,518
Likes: 0
Received 0 Likes on 0 Posts
Post

Use to use qbasic a fair bit - If I wanted to do it I'd use...

Print "Press <S> to Start or <X> to Exit"
DO
x$ = ucase$(Inkey$ )
if x$ = "S" then gosub CodeHere
if x$ = "X" then Exit do
loop
Print "Prog Finished"
End

CodeHere:
REM Loops & Bollox
Return


[Edited by dsmith - 6/11/2002 4:12:05 PM]
Old 11 June 2002, 04:54 PM
  #6  
Neil Smalley
Scooby Senior
 
Neil Smalley's Avatar
 
Join Date: Feb 2000
Posts: 8,204
Likes: 0
Received 0 Likes on 0 Posts
Exclamation

Is'nt this cheating by asking someone the answers?

If it's a test, then it'll do you no good in the long run to be told the answers..
Old 11 June 2002, 05:24 PM
  #7  
dsmith
Scooby Regular
 
dsmith's Avatar
 
Join Date: Mar 1999
Posts: 4,518
Likes: 0
Received 0 Likes on 0 Posts
Post

Sorry Dad
Old 11 June 2002, 07:07 PM
  #8  
HKSubaru
Scooby Senior
Thread Starter
 
HKSubaru's Avatar
 
Join Date: Apr 2002
Posts: 11,251
Likes: 0
Received 0 Likes on 0 Posts
Post

no, my cous' asked if i could solve it, if so he'd give me £50!
I didn't get it! ...He only game me 30 mins!
Old 11 June 2002, 08:07 PM
  #9  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

cheeky git.... taking 40 for yourself.... removing my code now..

David
Old 12 June 2002, 12:06 PM
  #10  
HKSubaru
Scooby Senior
Thread Starter
 
HKSubaru's Avatar
 
Join Date: Apr 2002
Posts: 11,251
Likes: 0
Received 0 Likes on 0 Posts
Post

i didn't get it! The loop never worked!
Old 12 June 2002, 12:09 PM
  #11  
HKSubaru
Scooby Senior
Thread Starter
 
HKSubaru's Avatar
 
Join Date: Apr 2002
Posts: 11,251
Likes: 0
Received 0 Likes on 0 Posts
Angry

Me muffing that up i had to play iss and he's better, he get's a fiver for a win and goals! he won me 8-1!
Old 06 November 2002, 02:19 PM
  #12  
dsmith
Scooby Regular
 
dsmith's Avatar
 
Join Date: Mar 1999
Posts: 4,518
Likes: 0
Received 0 Likes on 0 Posts
Post

difficult to point out specific errors but...

Label: should be Label1:

Asc(N$) should be Len(N$) - if comment is to be believed

Upper (N$) should be UCASE$(N$)

loops should be 1 to 5 not 1 to 7

Do line should be above the input line

no need then for last input line

next x and next y are thw rong way round

Its all abit sh*t really

Total will be (1 + 2 + 3 + 4 +5) + (2 + 4 + 6 + 8 + 10) etc..





[Edited by dsmith - 6/11/2002 2:33:19 PM]
Old 06 November 2002, 02:42 PM
  #13  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

Code available for £25

[Edited by David_Wallis - 6/11/2002 8:07:28 PM]
Old 06 November 2002, 02:45 PM
  #14  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

Code available for £25

[Edited by David_Wallis - 6/11/2002 8:07:54 PM]
Old 06 November 2002, 03:13 PM
  #15  
carl
Scooby Regular
 
carl's Avatar
 
Join Date: May 1999
Posts: 7,901
Likes: 0
Received 0 Likes on 0 Posts
Post

'Press S to Start' but it only checks for 'X to Exit' and allows anything else input to start the calculation. Also it relies on INPUT which requires you to press RETURN (so it's not 'Press X to exit' really). Can't remember much BASIC (what I learnt was on a Speccy) but INKEY$ used to be a better bet.

Also it goes to the trouble of assigning X+Y to Z, and X*Y to ZZ, but then doesn't use them any more

Of course, this is clearly a coursework assignment so you shouldn't really be enlisting help.

[Edited by carl - 6/11/2002 3:18:20 PM]
Old 06 November 2002, 04:09 PM
  #16  
carl
Scooby Regular
 
carl's Avatar
 
Join Date: May 1999
Posts: 7,901
Likes: 0
Received 0 Likes on 0 Posts
Post



[Edited by carl - 6/11/2002 4:10:36 PM]
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
djuk
Computer & Technology Related
3
25 February 2007 09:34 PM
john banks
Computer & Technology Related
3
01 July 2004 09:47 AM
john banks
ICE
9
20 December 2000 09:55 AM



Quick Reply: anyone know qbasic here?



All times are GMT +1. The time now is 01:54 PM.