PRINT USING help please!!!!
Posted: Mon Oct 06, 2008 10:21 pm
Ok, so my programming teacher gave my class a program that we had to write, and then told us not to do it. But, since I'm stubborn and refuse to give up once I've started something, I kept trying. Eventually, by teaching myself how to use functions and keywords he never taught us, I came up with what is below. I just want to know if this is the best way to do it with my limited beginner's knowledge.
The criteria for the program is as follows:
2.7) Ask the user to enter 3 numbers from 1000 - 9999. Have the computer ROUND them off to the nearest ten, hundred, and thousand. Have your OUTPUT at columns 1, 21, 41, 61.
NUMBER TEN HUNDRED THOUSAND
----- --- ---- -----
He also said that we HAVE to use PRINT USING.
This is what I came up with:
CLS
INPUT "Enter 3 numbers from 1000 - 9999: ", x, y, z
PRINT
PRINT "NUMBER"; TAB(21); "TEN"; TAB(41); "HUNDRED"; TAB(61); "THOUSAND"
PRINT
PRINT x; TAB(21); USING "##"; (x * (1 / 100));
PRINT TAB(41); USING "###"; (x * (1 / 10));
PRINT TAB(61); x
PRINT y; TAB(21); USING "##"; (y * (1 / 100));
PRINT TAB(41); USING "###"; (y * (1 / 10));
PRINT TAB(61); y
PRINT z; TAB(21); USING "##"; (z * (1 / 100));
PRINT TAB(41); USING "###"; (z * (1 / 10));
PRINT TAB(61); z
--------------------------------------------------------------------------------
How is it?
Thanks a million,
elmagic
The criteria for the program is as follows:
2.7) Ask the user to enter 3 numbers from 1000 - 9999. Have the computer ROUND them off to the nearest ten, hundred, and thousand. Have your OUTPUT at columns 1, 21, 41, 61.
NUMBER TEN HUNDRED THOUSAND
----- --- ---- -----
He also said that we HAVE to use PRINT USING.
This is what I came up with:
CLS
INPUT "Enter 3 numbers from 1000 - 9999: ", x, y, z
PRINT "NUMBER"; TAB(21); "TEN"; TAB(41); "HUNDRED"; TAB(61); "THOUSAND"
PRINT x; TAB(21); USING "##"; (x * (1 / 100));
PRINT TAB(41); USING "###"; (x * (1 / 10));
PRINT TAB(61); x
PRINT y; TAB(21); USING "##"; (y * (1 / 100));
PRINT TAB(41); USING "###"; (y * (1 / 10));
PRINT TAB(61); y
PRINT z; TAB(21); USING "##"; (z * (1 / 100));
PRINT TAB(41); USING "###"; (z * (1 / 10));
PRINT TAB(61); z
--------------------------------------------------------------------------------
How is it?
Thanks a million,
elmagic