2014-01-20 2 views
0

이것은 내 친구가 재미로 쓴 스크립트이며, 왜 작동하지 않는지 알 수없는 두 가지가 있습니다. 하나의 질문 번호 12는 항상 입력이 무엇인지에 관계 없습니다. 또한 설문지를 통해 enter 키를 누르면 자동으로 숫자 1이 선택되며 이유는 확실하지 않습니다.배치 오작동

그것은 당신이 코드에 "1"모양을 선택했다 생각하지 않는 0 ℃

title food quiz! 

:begin 
echo. 
echo  Hello! and welcome to the ...FOOD QUIZ... 
echo. 
echo To enter your answer, choose your answer, press space, then type the number 
echo your answer was listed as and press enter. 
pause. 
cls 


set score=0 
:Q1 
echo. 
echo question 1 
echo. 
echo In which country did creme brulee originate? 
echo. 
echo 1. Italy 
echo 2. Japan 
echo 3. France 
echo. 
pause 


set /p x=number 
if %x%==1 goto A 

if %x%==2 goto B 

if %x%==3 goto C 


:A 
cls 
echo. 
echo Sorry!... creme brulee is a french dish. 
pause 
goto Q2 

:B 
cls 
echo. 
echo Sorry!... creme brulee is a french dish. 
pause 
goto Q2 

:C 
cls 
echo. 
echo Correct! 
pause 
set /a score=score+1 
goto Q2 


:Q2 
cls 
echo. 
echo question 2 
echo. 
echo A waz wan is a celebratory ___ course meal from the Kashmir valley of india. 
echo. 
echo 1. 10 
echo 2. 25 
echo 3. 36 
echo. 
pause 
cls 

set /p x=number 
if %x%==1 goto A1 

if %x%==2 goto B1 

if %x%==3 goto C1 



:A1 
cls 
echo. 
echo Sorry!... a waz wan is a 36 course meal. only for special occasions. 
pause 
cls 
goto Q3 

:B1 
cls 
echo. 
echo Sorry!... a waz wan is a 36 course meal. only for special occasions. 
pause 
cls 
goto Q3 

:C1 
cls 
echo. 
echo Yes! waz wans are only for special occasion. 
pause 
cls 
set /a score=score+1 
goto Q3 


:Q3 
cls 
echo. 
echo question 3 
echo. 
echo What is "chiqueti"? (pronounced chiketi) 
echo. 
echo 1. small gourmet snacks favored by the gondoleirs of venice. 
echo 2. sausages from finland. 
echo 3. small bite sized rolls served as streetfood in the phillipines. 
echo. 
pause 
cls 

set /p x=number 
if %x%==1 goto A2 

if %x%==2 goto B2 

if %x%==3 goto C2 

:A2 
cls 
echo. 
echo Correct! 
pause 
cls 
set /a score=score+1 
goto Q4 

:B2 
cls 
echo. 
echo Nope! Chiqueti are small gourmet snacks favored by the gondoleirs of venice. 
pause 
cls 
goto Q4 

:C2 
cls 
echo. 
echo Nope! Chiqueti are small gourmet snacks favored by the gondoleirs of venice. 
pause 
cls 
goto Q4 

:Q4 
cls 
echo. 
echo question 4 
echo. 
echo Haggis is the national dish of which Country in the united Kingdom? 
echo. 
echo 1. England 
echo 2. Scotland 
echo 3. Wales 
pause 
cls 

set /p x=number 
if %x%==1 goto A3 

if %x%==2 goto B3 

if %x%==3 goto C3 

:A3 
cls 
echo. 
echo Incorrect! haggis is the national dish of scotland. haggis is the ground up 
echo pluck of a sheep, mixed with oats and echo onions, then stuffed in a sheep stomach and steamed. 
echo. 
pause 
cls 
goto Q5 

:B3 
echo. 
echo Yep! haggis is the ground up pluck of a sheep, mixed with oats and onions, then stuffed in a sheep stomach and steamed. 
echo. 
pause 
cls 
set /a score=score+1 
goto Q5 

:C3 
cls 
echo. 
echo Incorrect! haggis is the national dish of scotland. haggis is the ground up 
echo pluck of a sheep, mixed with oats and onions, then stuffed in a sheep stomach and steamed. 
echo. 
pause 
cls 
goto Q5 

:Q5 
cls 
echo. 
echo question 5 
echo. 
echo What is Borscht? 
echo. 
echo 1. an entree. 
echo 2. a dessert. 
echo 3. a soup like side dish. 
echo. 
pause 
cls 

set /p x=number 
if %x%==1 goto A4 

if %x%==2 goto B4 

if %x%==3 goto c4 

:A4 
cls 
echo. 
echo Sorry! Borscht is a russian soup like side dish. 
echo. 
pause 
cls 
goto Q6 

:B4 
cls 
echo. 
echo Sorry! Borscht is a russian soup like side dish. 
echo. 
pause 
cls 
goto Q6 

:C4 
cls 
echo. 
echo Yes! Borscht is usually a liquidy vegetable puree, sometimes containing milk. 
echo. 
pause 
cls 
set /a score=score+1 
goto Q6 

:Q6 
echo. 
echo question 6 
echo. 
echo Bleenies (aka bleens) are a popular streetfood of which country? 
echo. 
echo 1. Norway 
echo 2. Russia 
echo 3. romania 
echo. 
pause 
cls 

set /p x=number 
if %x%==1 goto A5 
if %x%==2 goto B5 
if %x%==3 goto C5 

:A5 
echo. 
echo Incorrect! Bleenies are a popular streetfood of Russia. 
echo. 
pause 
cls 
goto Q7 

:B5 
echo. 
echo Yes! 
echo. 
pause 
cls 
set /a score=score+1 
goto Q7 

:C5 
echo. 
echo Incorrect! Bleenies are a popular streetfood of Russia. 
echo. 
pause 
cls 
goto Q7 



:Q7 
echo. 
echo question 7 
echo. 
echo Kahlia is a Moraccan dish...What is "kahlia"? 
echo. 
echo 1. Meat, preserved in its own fat. 
echo 2. A type of lamb stew with dates. 
echo 3. A tea containing cinnamon, reportedly an aphrodisiac. 
echo. 
pause 
cls 

set /p x=number 
if %x%==1 goto A6 
if %x%==2 goto B6 
if %x%==3 goto C6 

:A6 
echo. 
echo Yes! Kahlia can be cooked with eggs and served as a breakfast food. 
echo. 
pause 
set /a score=score+1 
cls 
goto Q8 

:B6 
echo. 
echo Sorry! Kahlia is meat preserved in fat. 
echo. 
pause 
cls 
goto Q8 

:C6 
echo. 
echo Sorry! Kahlia is meat preserved in fat. 
echo. 
pause 
cls 
goto Q8 


:Q8 
echo. 
echo question 8 
echo. 
echo Muktuk is eaten by the native people of Alaska. What is muktuk? 
echo. 
echo 1. Raw seal skin with a layer of blubber. 
echo 2. Raw dolphin skin with a layer of blubber. 
echo 3. Raw whale skin with a layer of blubber. 
echo. 
pause 
cls 

set /p x=number 
if %x%==1 goto A7 
if %x%==2 goto B7 
if %x%==3 goto c7 

:A7 
echo. 
echo Sorry! Muktuk is Raw whale skin with a layer of blubber. 
echo. 
pause 
cls 
goto Q9 

:B7 
echo. 
echo Sorry! Muktuk is Raw whale skin with a layer of blubber. 
echo. 
pause 
cls 
goto Q9 

:C7 
echo. 
echo Yep! 
echo. 
pause 
set /a score=score+1 
cls 
goto Q9 


:Q9 
echo. 
echo question 9 
echo. 
echo Muktuk can be used to make which native Alaskan delicacy? 
echo. 
echo 1. Lunuk. 
echo 2. Tunuk. 
echo 3. Dunuk. 
echo. 
pause 
cls 

set /p x=number 
if %x%==1 goto A8 
if %x%==2 goto B8 
if %x%==3 goto C8 

:A8 
echo. 
echo Nope! Muktuk is used to make Dunuk. Dunuk is a fermented whale oil used as a sauce for other whale products. 
echo. 
pause 
cls 
goto Q10 

:B8 
echo. 
echo Nope! Muktuk is used to make Dunuk. Dunuk is a fermented whale oil used as a sauce for other whale products. 
echo. 
pause 
cls 
goto Q10 

:C8 
echo. 
echo Yes! Dunuk is a fermented whale oil used as a dipping sauce for other whale products. 
pause 
set /a score=score+1 
cls 
goto Q10 

:Q10 
echo. 
echo question 10 
echo. 
echo Kopi Luwak is which type of beverage? 
echo. 
echo 1. A Balinese broth made from rhino beetle larvae. 
echo 2. A coffee made from digested coffe beans excreted from the wild civet cat. 
echo 3. A cold smoothie like drink also made from muktuk. 
echo. 
pause 
cls 

set /p x=number 
if %x%==1 goto A9 
if %x%==2 goto B9 
if %x%==3 goto C9 

:A9 
echo. 
echo Incorrect! Kopi Luwak is a coffee made from digested and excreted coffee beans ingested by the civet cat. 
echo. 
pause 
cls 
goto Q11 

:B9 
echo. 
echo Yes! Kopi Luwak is a coffee made from digested and excreted coffee beans ingested by the civet cat. 
echo. 
pause 
set /a score=score+1 
cls 
goto Q11 

:C9 
echo. 
echo Incorrect! Kopi Luwak is a coffee made from digested and excreted coffee beans ingested by the civet cat. 
echo. 
pause 
cls 
goto Q11 




:Q11 
echo. 
echo question 11 
echo. 
echo What is "Hicarl"? 
echo. 
echo 1. fermented meat from the greenlandic shark. 
echo 2. A Finish greeting used only to greet people named Carl. 
echo 3. A native Maori pork dish. 
echo. 
pause 
cls 

if %x%==1 goto A10 
if %x%==2 goto B10 
if %x%==3 goto C10 

:A10 
echo. 
echo Yes! 
echo. 
echo Hicarl is made in Iceland using the Greenlandic shark. 
echo. 
pause 
set /a score=score+1 
cls 
goto Q12 

:B10 
echo. 
echo No! 
echo. 
echo Hicarl is made in Iceland using the Greenlandic shark. 
echo. 
pause 
cls 
goto Q12 


:C10 
echo. 
echo No! 
echo. 
echo Hicarl is made in Iceland using the Greenlandic shark. 
echo. 
pause 
cls 
goto Q12 




:Q12 
echo. 
echo question 12 
echo. 
echo Where is it beleived that coffee originated? 
echo. 
echo 1. Ethiopia 
echo 2. Hawaii 
echo 3. Colombia 
echo. 
pause 
cls 

if %x%==1 goto A11 
if %x%==2 goto B11 
if %x%==3 goto C11 



:A11 
echo. 
echo YES! 
echo. 
echo It is said that an Ethiopian herder observed that his goats became very frisky after eating the bean of the coffee tree. 
echo. 
pause 
cls 
set /a score=score+1 
goto end 

:B11 
echo. 
echo WRONG :(
echo. 
echo It is said that an Ethiopian herder observed that his goats became very frisky after eating the bean of the coffee tree. 
echo. 
pause 
cls 
goto end 

:C11 
echo. 
echo WRONG :(
echo. 
echo It is said that an Ethiopian herder observed that his goats became very frisky after eating the bean of the coffee tree. 
echo. 
pause 
cls 
goto end 






:end 
echo Congrats! you have finished the food quiz! 
echo    ----------------- 
echo your score is  %score% 
echo    ----------------- 
echo. 
echo 1. Play again 
echo 2. exit. 
echo. 
pause 
cls 

set /p x=number 
if %x%==1 goto begin 
if %x%==2 exit 

답변

0

set /p x=number 그냥 Enter 키를 누르면 % x %이 (가) 설정되지 않습니다. 그것은 단지 % x % 그대로입니다. 수정하려면 set x=0 앞에 set /p x=number을 추가하십시오.

:Q2 
echo Question and answers 

set x=0 
set /p x=number 
if %x%==1 goto A2 
if %x%==2 goto B2 
if %x%==3 goto C2 
echo "wrong input" 
goto :Q1 

은 또한 그들이에 보이는 cls의 사용을 overthink해야합니다 또한 당신은 쉽게 예를 들어 "3"

을, ("2"를 "1"이외의 답변을 몇 가지 오류 검사를 구현하고 있습니다 이상한 장소 ^^ 코드를 수정하여

에있을, 당신은 Q12 자신의 행동에 대한 이유를 알 수 있습니다 -.없는 뭔가가

+0

감사합니다. 추가하겠습니다. 내가 너의 제안을 버리고 코드를 다시 내 친구에게 보낸다. – imaginecode

0

색상을 @echo : 그것은 A1에가는 형성이 중지됩니다

:Q1 

rem You need this: 
cls 

echo stuff 
set /p x= 
if %x% == ?? goto A1 

rem And this: 
goto Q1 

:A1 

.

Q12의 경우 set /p x=이 필요합니다. :)

편집 : set /a score+=1이 아닌 set /a score=score+1을 사용할 수 있습니다.

+0

덕분에 많이, 내 친구가 올바르게 작동 얻을 드릴 것입니다. – imaginecode