Login Register






need some help with a batch quiz?? filter_list
Author
Message
need some help with a batch quiz?? #1
I am trying to make a batch quiz, i have completed it but there is a bug somwhere and i cant find it, can someone help me, coz every time i answer the first question correctly it yakes me to the second question and then says that i got it wrong???



Here is the code

@echo off
title Test Your Skills At HTML and CSS
:Register
echo Please input your name
set /p name=name:
pause
goto Game


:Game
cls
echo Welcome to the quiz %name%, this quiz is designed to test your knowledge of HTML and CSS, lets start.
pause
cls

echo Question 1
echo What does HTML stand for?
echo.
echo 1) Hypodermic Tetnus Measels Laxative
echo 2) Hyper Text Makeup Language
echo 3) Hyper Text Markup Language
set /p ans=
if %ans% == 1 goto false
if %ans% == 2 goto false
if %ans% == 3 goto 2


:2
pause
echo Question 2
echo What does CSS stand for?
echo.
echo 1) Cascading Snow Sheet
echo 2) Cascading Style Sheet
echo 3) Computer System Catastrophic failure
if %ans% == 1 goto false
if %ans% == 2 goto 3
if %ans% == 3 goto false

:3
pause
echo Question 3
echo In CSS if you wanted to change the body background, waht code would you use?
echo.
echo 1) body {bg-color: COLOUR; }
echo 2) body {b-ground-color: COLOUR; }
echo 3) body {backgroung-color: COLOUR; }
if %ans% == 1 goto false
if %ans% == 2 goto false
if %ans% == 3 goto 4

:4
pause
echo Question 4
echo In HTML if you wanted to add a break in a line what tag would you use?
echo.
echo 1) <br />
echo 2) <break
echo 3) <br>
if %ans% == 1 goto 5
if %ans% == 2 goto false
if %ans% == 3 goto false

:5
pause
echo Question 5
echo In CSS if you wanted to change the distance between the left hand side of a webpage and the content what code would you use?
echo.
echo 1) body {marg-left: XXXpx; }
echo 2) body {margin-left: XXXpx; }
echo 3) body {ma-left: XXXpx; }
if %ans% == 1 goto false
if %ans% == 2 goto 6
if %ans% == 3 goto false

:6
pause
echo Question 6
echo In HTML how would you link an external CSS to your webpage?
echo.
echo 1) <link rel="stylesheet" type="text/css" href="XXX.css" />
echo 2) <link rel="stylesheet" type="text/css" src="XXX.css! />
echo 3) <a href="stylesheet.css" />
if %ans% == 1 goto 7
if %ans% == 2 goto false
if %ans% == 3 goto false

:7
pause
echo Question 7
echo In CSS if you had a <div class="XXX"> tag how would you specify that specific tag?
echo.
echo 1) div.XXX { ACTION: VARIABLE; }
echo 2) divXXX { ACTION: VARIABLE; }
echo 3) XXX.div { ACTION: VARIABLE; }
if %ans% == 1 goto 8
if %ans% == 2 goto false
if %ans% == 3 goto false

:8
pause
Question 8
echo In Html what are the tags <ol> and <ul> used for?
echo.
echo 1) Overline and Underline
echo 2) Ordered list and Un ordered list
echo 3) Ordinary line and Ultra line
if %ans% == 1 goto false
if %ans% == 2 goto 9
if %ans% == 3 goto false

:9
pause
echo Question 9
echo In HTML what tag would you use to specify that you want to insert a table?
echo.
echo 1) <t>
echo 2) <tab>
echo 3) <table>
if %ans% == 1 goto false
if %ans% == 2 goto false
if %ans% == 3 goto 10

:10
pause
echo Question 10
echo In HTML what is the <!DOCTYPE html> declaration for?
ho.
echo 1) To declare what kind of HTML you are writing in
echo 2) To tell the browser how to read the HTML
echo 3) To tell the browser weather or not to send cookies to the computer
set /p Finish=
if %Finish% == 1 goto Finish
if %ans% == 2 goto false
if %ans% == 3 goto false

:Finish
pause
echo Well done you finished my quiz on HTML and CSS, keep on looking out for more quizzes and games made by me, theres bound to be some more soon!
pause
exit

:false
pause
echo You got a question wrong, sorry but you must go back to the start and try again
pause
goto Game



Reply

RE: need some help with a batch quiz?? #2
You are not inputing any value for answer for any question after question one. So it takes the value of ans to be the same as what you inputted in the first question. Thus, this it the bug.
Folow me on My YouTube Channel if you're into art.

Reply

RE: need some help with a batch quiz?? #3
thanks ill fix it now Smile Smile

Reply

RE: need some help with a batch quiz?? #4
Code:
@echo off title Test Your Skills At HTML and CSS :Register echo Please input your name set /p name=name: goto Game :Game cls echo Welcome to the quiz %name%, this quiz is designed to test your knowledge of HTML and CSS, lets start ping -n 3 localhost >NUL. cls echo Question 1 echo What does HTML stand for? echo. echo 1) Hypodermic Tetnus Measels Laxative echo 2) Hyper Text Makeup Language echo 3) Hyper Text Markup Language echo. set /p ans=Answer: if %ans% == 1 goto false if %ans% == 2 goto false if %ans% == 3 goto 2 goto game :2 cls echo Question 2 echo What does CSS stand for? echo. echo 1) Cascading Snow Sheet echo 2) Cascading Style Sheet echo 3) Computer System Catastrophic failure echo. set /p ans=Answer: if %ans% == 1 goto false if %ans% == 2 goto 3 if %ans% == 3 goto false :3 cls echo Question 3 echo In CSS if you wanted to change the body background, waht code would you use? echo. echo 1) body {bg-color: COLOUR; } echo 2) body {b-ground-color: COLOUR; } echo 3) body {backgroung-color: COLOUR; } echo. set /p ans=Answer: if %ans% == 1 goto false if %ans% == 2 goto false if %ans% == 3 goto 4 :4 cls echo Question 4 echo In HTML if you wanted to add a break in a line what tag would you use? echo. echo 1) <br /> echo 2) <break echo 3) <br> echo. set /p ans=Answer: if %ans% == 1 goto 5 if %ans% == 2 goto false if %ans% == 3 goto false :5 cls echo Question 5 echo In CSS if you wanted to change the distance between the left hand side of a webpage and the content what code would you use? echo. echo 1) body {marg-left: XXXpx; } echo 2) body {margin-left: XXXpx; } echo 3) body {ma-left: XXXpx; } echo. set /p ans=Answer: if %ans% == 1 goto false if %ans% == 2 goto 6 if %ans% == 3 goto false :6 cls echo Question 6 echo In HTML how would you link an external CSS to your webpage? echo. echo 1) <link rel="stylesheet" type="text/css" href="XXX.css" /> echo 2) <link rel="stylesheet" type="text/css" src="XXX.css! /> echo 3) <a href="stylesheet.css" /> echo. set /p ans=Answer: if %ans% == 1 goto 7 if %ans% == 2 goto false if %ans% == 3 goto false :7 cls echo Question 7 echo In CSS if you had a <div class="XXX"> tag how would you specify that specific tag? echo. echo 1) div.XXX { ACTION: VARIABLE; } echo 2) divXXX { ACTION: VARIABLE; } echo 3) XXX.div { ACTION: VARIABLE; } secho. set /p ans=Answer: if %ans% == 1 goto 8 if %ans% == 2 goto false if %ans% == 3 goto false :8 cls Question 8 echo In Html what are the tags <ol> and <ul> used for? echo. echo 1) Overline and Underline echo 2) Ordered list and Un ordered list echo 3) Ordinary line and Ultra line echo. set /p ans=Answer: if %ans% == 1 goto false if %ans% == 2 goto 9 if %ans% == 3 goto false :9 cls echo Question 9 echo In HTML what tag would you use to specify that you want to insert a table? echo. echo 1) <t> echo 2) <tab> echo 3) <table> echo. set /p ans=Answer: if %ans% == 1 goto false if %ans% == 2 goto false if %ans% == 3 goto 10 :10 cls echo Question 10 echo In HTML what is the <!DOCTYPE html> declaration for? ho. echo 1) To declare what kind of HTML you are writing in echo 2) To tell the browser how to read the HTML echo 3) To tell the browser weather or not to send cookies to the computer echo. set /p ans=Answer: if %Finish% == 1 goto Finish if %ans% == 2 goto false if %ans% == 3 goto false :Finish echo Well done you finished my quiz on HTML and CSS, keep on looking out for more quizzes and games made by me, theres bound to be some more soon! exit :false echo You got a question wrong, sorry but you must go back to the start and try again goto Game

My version of your code Smile

Reply