OK, any help with this one
Write a program that will produce the following output by using the LEFT$ function.
O
ON
ONO
ONOM
ONOMA
ONOMAT
ONOMATO
ONOMATOP
ONOMATOPO
ONOMATOPOE
ONOMATOPOEI
ONONMATOPOEIA
This is waht I came up with (below) but I get a mismatch error on the first X and I have no clue why or what it means
CLS
x = "ONONMATOPOEIA"
i = 1
DO UNTIL i = 13
Print Left$(x,i)
Print
i = i+1
LOOP
End
Thanks everyone
QBASIC homework assistance; again!
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
Code: Select all
DIM x AS STRING 'x must be a string variable or use the $ suffix after it as x$
CLS
x = "ONONMATOPOEIA"
i = 1
DO UNTIL i = 14 'change to 14 letters or use LOOP UNTIL i = 14 instead
Print Left$(x,i)
'Print 'remove so it doesn't scroll screen
i = i+1
LOOP
End
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0