Log in

View Full Version : Qbasic programing


Simonne
Oct 22, 2009, 03:10 PM
Please help me I have no idea how to program this thing!


Develop a program using loops that displays rows of asterisks in two different ways:
1. Ascending then Descending

*
**
***
****
*****
******
*******
********
*********
********
*******
******
*****
****
***
**
*
2. Descending then Ascending

*********
********
*******
******
*****
****
***
**
*
**
***
****
*****
******
*******
********
*********

The maximum number of asterisks in any row is 9.
The program should prompt the user as to which of the above
Display methods should be used.

Hint: Use nested loops.

ScottGem
Oct 22, 2009, 03:32 PM
QBasic.com (http://www.qbasic.com)

Perito
Oct 23, 2009, 02:23 PM
Ascending then Descending:

For I = 1 to 9
for j = 1 to I
Print "*"; ' the semi-colon prevents a new line from being written
next j
print ' gets a new line
next I
for I = 8 to 1 step -1 ' I'm not sure this is QuickBasic's syntax, but there is something.
for j = 1 to I
print "*"; ' the semicolon prevents a new line from being written.
next j
print ' gets a new line.
next I

Descending then ascending is very similar.

There are many other ways to program this also -- some simpler than others.

Simonne
Oct 26, 2009, 07:50 AM
Thank you very much for your help, I will try it out and see what I get.
Thanks

Simonne
Nov 10, 2009, 09:10 AM
Thank you that really did help.