[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 [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 [phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027) [phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027) [phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027) [phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027) Simple QBASIC Question - Pete's QBASIC Site
PRINT "Select a gender:"
PRINT "1. Male"
PRINT "2. Female"
GENDER:
INPUT "> ", G$
IF G$ = "1" THEN
PRINT
PRINT "1, Selected."
ELSE PRINT "Please select 1 or 2."
GOTO GENDER
END IF
IF G$ = "2" THEN
PRINT
PRINT "2, Selected."
ELSE PRINT "Please select 1 or 2."
GOTO GENDER
END IF
The problem I have as that when I select 1 it conflicts with 2 and says "Please select 1 or 2." and If I select 2 it conflicts with 1 and says "Please select 1 or 2." I'm sure there is an easy fix to this, I just have forgot been away from the language too long.
' First get a valid choice from the user
PRINT "Select a gender:"
PRINT "1. Male"
PRINT "2. Female"
DO
INPUT "> ", G$
IF G$ <> "1" AND G$ <> "2" THEN PRINT "Please select 1 or 2."
LOOP WHILE G$ <> "1" AND G$ <> "2"
' Then process the valid choice
IF G$ = "1" THEN
PRINT "1, Selected."
ELSE
PRINT "2, Selected."
END IF
' First get a valid choice from the user
PRINT "Select a gender:"
PRINT "1. Male"
PRINT "2. Female"
PRINT "3. Cyborg"
PRINT "4. None "
DO
INPUT "> ", G$
IF G$ <> "1" AND G$ <> "2" AND G$ <> "3" AND G$ <> "4" THEN
PRINT "Please select 1, 2, 3 or 4."
END IF
LOOP WHILE G$ <> "1" AND G$ <> "2" AND G$ <> "3" AND G$ <> "4"
' Then process the valid choice
IF G$ = "1" THEN
PRINT "1, Selected."
ELSEIF G$ = "2" THEN
PRINT "2, Selected."
ELSEIF G$ = "3" THEN
PRINT "3, Selected."
ELSE
PRINT "4, Selected."
END IF
' Then process the valid choice
SELECT CASE G$
CASE = "1": PRINT "1, Selected."
CASE = "2": PRINT "2, Selected."
CASE = "3": PRINT "3, Selected."
CASE = "4": PRINT "4, Selected."
END SELECT
Daniel "Theophage" Clark
theophage (at) geocities (dot) com
"God used to be my co-pilot, but our plane crashed in the mountains and I had to eat Him..."
Wow alright, the CASE is a lot easier to use and a lot less typing. Also, good to know is when none of the cases is met to use
CASE ELSE PRINT "Please choose 1, 2, 3 or 4."
END SELECT