Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 syntax error
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
cutiegirl_14_16




PostPosted: Sun May 18, 2003 2:03 pm   Post subject: syntax error

I'm writing a program, and turing gave me a syntax error, and I can't figure out why. Any hlep would be greatly appreciated ASAP, thanx.
The highlighted part is the part where the error is.

Here's the program

MOD Edit: Attached that huge source as a file - Tony



file.t
 Description:
source

Download
 Filename:  file.t
 Filesize:  24.53 KB
 Downloaded:  246 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Sun May 18, 2003 2:47 pm   Post subject: (No subject)

that whould be beucse the the label is not in a case. labels need to be in a case or thye will not wrok, you probley whont an if there.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
cutiegirl_14_16




PostPosted: Sun May 18, 2003 3:09 pm   Post subject: (No subject)

but I thought that I did, because at the beginning I have a case construct (I highlighted it in blue 4 u) and the label 2 is part of it.
var middlerow : int := maxrow div 2

var middlecol : int := maxcol div 2

var decision1, decision2, decision3, decision4, decision5, decision6, decision7, decision8,
decision9, decision10, decision11, decision12, decision13, decision14, decision15, decision16,
decision17, decision18, decision19, decision20, decision21, decision22, decision23,
decision24, decision25, decision26, decision27, decision28, decision29, decision30,
decision31, decision32, decision33, decision34, decision45, decision36, decision37,
decision38, decision39, decision40, decision41, decision42, decision43, decision44,
deicison45, deicison46, decision46, decision47, decision48, decision49, decision50,
decison51, decision52 : int
var ready1, ready2, ready3, ready4, ready5, ready6, ready7, ready8, ready9, ready10, ready11, ready12,
ready13, ready14, ready15 : string
var fonttahoma, fontcomic, fontarial, fontcourier, fonttimes : int

var count, count2 : int := 0






colour (12)



setscreen ("graphics")

locate (middlerow, middlecol - 10)

drawfillmapleleaf (100, 210, 200, 350, 12)

drawfillmapleleaf (450, 205, 550, 350, 12)


for blink : 1 .. 20
fonttahoma := Font.New ("tahoma:20:bold")
assert fonttahoma > 0
delay (100)
Font.Draw ("THE CANADIAN GOVERNMENT", 120, 100, fonttahoma, black)
delay (100)
Font.Draw ("THE CANADIAN GOVERNMENT", 120, 100, fonttahoma, white)
end for

cls


fontcomic := Font.New ("Comic Sans MS:11:bold")
assert fontcomic > 0
Font.Draw ("INSTRUCTIONS", maxx - 375, maxy - 10, fontcomic, 12)

locate (2, middlecol - 5)

put "============"
fontcomic := Font.New ("Comic Sans MS:11")
Font.Draw ("This is an educational program which will inform and quiz you on the",



0, 350, fontcomic, 12)
Font.Draw ("components and responsibilities of the provincial and federal governments,",



0, 330, fontcomic, 12)
Font.Draw ("and the main political parites.", 0, 310, fontcomic, 12)
Font.Draw (" ", 0, 290, fontcomic, white)
Font.Draw (" ", 0, 270, fontcomic, white)

Font.Draw ("You will first read the information on each government component, and then",



0, 250, fontcomic, 12)
Font.Draw ("you will be able to take a quiz on the newly learned information.",



0, 230, fontcomic, 12)

colour (white)
put "Are you done? (enter y if done)"
get ready1
if ready1 = "y"
then
loop
cls

put "Which subject would you like to cover?"
put "1)The provincial government"
put "2)The federal government"
put "3)The responsibilities of the federal and provincial governments"
put "4)Exit"
get decision2
case decision2 of
label 1 :
cls
colour (12)
fonttimes := Font.New ("Times New Roman:12:bold")
assert fonttimes > 0
delay (1000)
colourback (black)
put "THE PROVINCIAL GOVERNMENT"
put "========================="
put
"-The provincial legislature consists of The queen (represeted by thelLieutenant governor),"
put "and an elected legislature."
put ""
put "THE QUEEN"
put "========="
put
"-The queen in the provincial legislature is represented by the lieutenant "
put "governor."
put
"-Before bills become law in the provincial government the lieutenant "
put "governor must sign them."
put
"-lieutenant governors summon the provincial legislation to meet."
put "-To call elections."
put ""
put ""
put ""
put ""
put ""
put ""
put ""
put ""
put ""
put ""
put ""
put ""


colour (white)
put "Are you done? (enter y if done)"
get ready2
if ready2 = "y"
then
cls
colour (12)
put "THE ELECTED LEGISLATURE"
put "======================="
put ""
Font.Draw ("The speaker of the house", 0, maxy - 40, fonttimes,
12)
put "- They're responsible for keeping order in debates."
put
"- They're also responsible in making the day-to-day decisions."
put
"- The speaker is elected by their peers, and is a member of"
..
put " the legislature."
put "- They're supposed to be impartial, but it's sometimes"
put " difficult because the speaker of the house comes"
put " from a political party, or is independent."


put ""

Font.Draw ("The premier", 0, maxy - 158, fonttimes, 12)
put
"- This person is usually the leader of the political party that"
put " has the most seats in the legislature."
put
"- The premier is the most powerful person in the legislature."
put ""
Font.Draw ("The cabinet of ministers", 0, maxy - 220, fonttimes,
12)
put "- They're selected by the premier." ..
put "- They're responsible for different areas of"
put " public policy."
put "- They're usually from the premier's own party, but can be"
put " from other parties."
put "- The cabinet directs government policy."
colour (white)
put "Done reading? (enter y if done)"
get ready3
if ready3 = "y"
then
cls
colour (white)
Font.Draw ("The leader of the official opposition", 0, maxy -
10, fonttimes, 12)
put "- This person is usually the leader of the party with the"
put " second highest votes in the legislature."
put "- They critisize, and make recommendations for alterations"
put " to government policy."
put ""
Font.Draw ("Shadow cabinet", 0, maxy - 75, fonttimes, 12)
put "- The leader of the offical opposition selects the Shadow"
put " cabinet."
put "- They also critisize government policy."
put "- The members of the shadow cabinet cover the same areas"
put " of public policy that the cabinet members do."
put ""
Font.Draw ("Members of the Proincial Parliament(MPPs)", 0, maxy
- 175, fonttimes, 12)
put "- They are elected to serve the voters."
put "- They're almost always a member of a political party."
put "- They usually follow the instructions of their party when"
put " voting in legislature."
put "- Other MPPs are a part of the official opposition."
Pic.ScreenLoad ("ernie evesrevised2.jpg", 480, 0, picUnderMerge)
drawline (300, 120, 400, 100, 12)
drawline (400, 100, 380, 80, 12)
drawline (400, 100, 380, 120, 12)
fontcomic := Font.New ("comic Sans MS:18")
Font.Draw ("Our Ontario Premier", 150, 90, fontcomic, 12)
Font.Draw ("Ernie Eves", 150, 70, fontcomic, 12)




colour (white)
put "Are you ready to take the quiz?"
put "1)yes....let's go!"

get decision2

if decision2 = 1
then
cls

put "THE PROVINCIAL GOVERNMENT QUIZ!"
put "==============================="

put
"1. What are the two components of the provincial legislature?"
put "1)executive and legislative"
put "2)the queen and the elected legislature"
put "3)the MPPs and the queen"
get decision3
case decision3 of
label 1 :
put "Wrong! it's 2"

label 2 :
put "Yes!"
count := count + 1

label 3 :
put "Wrong! it's 2"

end case

put "2. On a provincial level, who represents the queen?"
put "1)lefttenant governor"
put "2)lieutenant governor"
put "3)lovernor general"
get decision4
case decision4 of
label 1 :

put "Wrong! it's 2"

label 2 :

put "Yes!"
count := count + 1

label 3 :
put "Wrong! it's 2"
end case
put "3. What is one of the lieutenant governors/queens roles?"
put "1)to entertain international leaders"
put "2)to run the legislation"
put "3)to sign bills into law"
get decision5
case decision5 of
label 1 :
put "Wrong! it's 3"

label 2 :
put "Wrong! it's 3"

label 3 :
put "Yes!"
count := count + 1
end case
put
"4. What are the six elements of the elected legislature?"
put
"1)speaker of the house,premier,cabinet of ministers,leader of official"
put "opposition,shadow cabinet,MPPs"
put
"2)speaker of the house,queen,premier,leader of the offical opposition"
put "shadow cabinet,cabinet of ministers"
put
"3)speaker of the house,governor general, leader of the official"
put "opposition, shadow cabinet, MPPs,premier"
get decision6
case decision6 of
label 1 :
put "Yes!"
count := count + 1

label 2 :
put "Wrong! it's 1"

label 3 :
put "Wrong! it's 1"

end case
put
"5.Who is the most powerful person in the legislature?"
put "1)the queen"
put "2)the premier"
put "3)the MPPs"
get decision7
case decision7 of
label 1 :
put "Wrong! it's 2"

label 2 :
put "Yes!"
count := count + 1

label 3 :
put "Wrong!it's 2"
end case

put
"6. What is the name of the people who are elected to"
put "serve the voters?"
put "1)MPs"
put "2)MVPs"
put "3)MPPs"
get decision8
case decision8 of
label 1 :
put "Wrong!it's 3"

label 2 :
put "Wrong! it's 3"

label 3 :
put "Yes!"
count := count + 1
end case
put "7.The premier selects the member of what?"
put "1)shadow cabinet"
put "2)cabinet of ministers"
put "3)premier cabinet of ministers"
get decision9
case decision9 of
label 1 :
put "Wrong! it's 2"

label 2 :
put "Yes!"
count := count + 1
label 3 :
put "Wrong! it's 2"

end case
put
"8. The cabinet only consists of people from the premiers party"
put "1)True"
put "2)False"
get decision10
case decision10 of
label 1 :
put "Wrong! It's false"
label 2 :
put "Yes!"
count := count + 1
end case
put
"9.The party with the highest votes in the legislation usually"
put "makes up the shadow cabinet"
put "1)True"
put "2)False"
get decision11
case decision11 of
label 1 :
put "Wrong! it's false"
label 2 :
put "Yes!"
count := count + 1
end case
put
"10.The party with the second most seats in the legislation"
put "makes up the shadow cabinet"
put "1)True"
put "2)False"

get decision12
case decision12 of
label 1 :
put "Yes!"
count := count + 1
label 2 :
put "Wrong! it's true"
end case
put
"11. The speaker of the house is responsble for keeping order in"
put "the House of Commons"
put "1)True"
put "2)False"
get decision13
case decision13 of
label 1 :
put "Yes!"
count := count + 1
label 2 :
put "Wrong! it's true"
end case
put
"12. MPPs are almost never a part of a political party"
put "1)True"
put "2)False"
get decision14
case decision14 of
label 1 :
put "Wrong! it's false"
label 2 :
put "Yes!"
count := count + 1
end case
put "13. Ernie Eves is the premier of Ontario"
put "1)True"
put "2)False"
get decision15
case decision15 of
label 1 :
put "Yes!"
count := count + 1
label 2 :
put "Wrong! it's true"
end case
put
"14.The members of the shadow cabinet cover the same areas"
put "of public policy that the cabinet members do."
put "1)True"
put "2)False"
get decision16
case decision16 of
label 1 :
put "Yes!"
count := count + 1
label 2 :
put "Wrong! it's true"
end case
put "15.The shadow cabinet and official opposition leader both"
put "critisize government policy"
put "1)True"
put "2)False"
get decision17
case decision17 of
label 1 :
put "Yes!"
count := count + 1
label 2 :
put "Wrong! it's true"
end case
fontcomic := Font.New ("comic Sans MS:18")
assert fontcomic > 0

Font.Draw ("YOUR RESULTS!", 200, 70, fontcomic, 12)

locate (maxrow - 3, 10)
put "On this quiz you got ", count, " out of 15!"
locate (maxrow - 2, 10)
put "That's ", (count / 15) * 100, " percent!"



label 2 :
cls
colour (12)
fonttimes := Font.New ("Times New Roman:16:bold")
assert fonttimes > 0


put ""
put ""
locate (1, maxcol - 45)
put "THE FEDERAL GOVERNMENT"
for i : maxcol - 45 .. maxcol - 24
locate (2, i)
put "$"
delay (200)
end for


put "The federal Government consists of three branches."
put "-The Executive Branch"
put "-The Legislative Branch"
put "-The Judicial Branch"

locate (1, maxcol div 2 - 5)
put "EXECUTIVE BRANCH"
locate (2, maxcol div 2 - 5)
put "****************"

put "GOVERNOR GENERAL"
put "================"

put "-Represents the queen in all of Canada, especially the federal Parliament."
put "-Is the head of state."
put "-A new governor general is selected every five years by the prime minister"
put " to be reccomends a person who may be appointed by the queen."
put "-Most of the governor generals duties are ceremonial."
put "-The governor general opens and closes federal Parliament."
put "-They also reads the government's Throne Speech."
put "-They sign bills into law."
put "-They also present awards and honours."
put ""
colour (white)
put "Are you done? (enter y if done)"
get ready7
if ready7 = "y"
then
cls
colour (12)
put "PRIME MINISTER"
put "=============="
put "-The key figure in the federal government."
put "-Is the head of government."
put "-Holds the real political power."
put "-The individual is not voted for."
put "-The public votes on the party, and the winning party leader wins."
put "-That political party controls the House of Commons."
put "-Selects the cabinet of ministers."
put "-Represents Canada internationally."
put "-Appoints Supreme Court judges."




colour (12)
Pic.ScreenLoad ("Chretien2.jpg", 440, 0, picCopy)
drawline (300, 120, 400, 100, 12)
drawline (400, 100, 380, 80, 12)
drawline (400, 100, 380, 120, 12)
fontcomic := Font.New ("comic Sans MS:18")
Font.Draw ("Our Canadian prime minister", 60, 90, fontcomic, 12)
cls
put "THE CABINET"
put "==========="
put "-A government formed with all the members of the premier's party."
put "-They head government departments such as foreign affairs,justice,"
put "finance,health,and fisheries."
put "-They must practice Cabinet solidarity, which is behind closed doors"
put "the cabinet debates issues, abut once a decisionis made, in public"
put "the cabinet must support the decision."
put "-If a cabinet member doesn't support the decision in public they are"
put "asked to resign, or they are taken out of the cabinet and someone else."

put "THE PUBLIC SERVICE"
put "=================="
put "-This is also called the Civil Service."
put "-Also part of the executive branch of the federal government."
put "-These people are employees of the government."
put "-They are appointed, not elected."
put "-The jobs don't change when the government in power changes."
put "-They do many things, like deliver mail, collect taxes,and issue"
put " passports to name a few things."
put "-Because they provide the public with very important services,"
put " they get paid out of taxes. "
put ""
put ""
colour (white)
put "Are you done? (enter y if done)"
get ready6
if ready5 = "y"
then
colour (12)
cls
put "THE LEGISLATIVE BRANCH"
put "**********************"
put ""
put "THE HOUSE OF COMMONS"
put "===================="
put "-The most important part of the legislative branch."
put "-Where the elected representatives meet, debate, and vote on bills."
put "-Consists of members of the winning, and non-winning parties."
put "-Canada had 301 ridings."
put "-Each riding elects one MP (Member of Parliament)."
put "-The candidate that gets the most number of votes wins that"
put " riding, and then sits in the House of Commons."
put "-Debating legislation (bills) is one of the most important function"
put " of a member."
put "-Since the speaker of the house is supposed to act as the 'referee',"
put " and since they come from a certain political party, impartiality is"
put " very difficult"
put "-One of the opposition's most evident functions, happens during the"
put "question period. this is where they can raise questions and concerns"
put "that they have about the cabinet and prime ministers actions. "
put ""
put "THE SENETE"
put "=========="
put "-The Senetors in the Senete aren't elected. They're appointed by the"
put "governor general."
put "-The Senete's job is to suggest modifications to the legislation, which"
put "was passed by the House of Commons."
put "-The Senete's other job is to keep a check on the House of Commons."
put "-The Senete can refuse to pass a legislation from the House of Commons,"
put "but doesn't often."
put "-Some citizens feel that the Senete should be abolished because they're"
put "not elected, so therefore they aren't democratic."
put "-Also, since the Senators are appointed they may not be qualified to make"
put "certain decisions."
put ""
colour (white)
put "Are your done? (enter y if done)"
get ready9
if ready9 = "y"
then
colour (12)
cls
put "THE JUDICIAL BRANCH"
put "*******************"
put ""
put "COURTS"
put "======"
put "- They interpret laws, and they settle conflicts between,"
put "- people,individuals and government,and government and government"
put "- The highest court in Canada is the supreme court"
put "- Judges, the attorney general,lawyers,an juries carry out these"
put " responsibilities."

loop
put "Are you ready to take the quiz?"
put "1)yes....let's go!"
get decision18
if decision18 = 1
then

put "1.What are the three branches of the federal government?"
put "1)executive,provincial,legislative"
put "2)legislative,judical,provincial"
put "3)judicial,legislative,executive"
get decision19
case decision19 of
label 1 :
put "Wrong! it's 3"
label 2 :
put "Wrong! it's 3"
label 3 :
put "Yes!"
count2 := count2 + 1
end case
put "2.Senetors are ___________"
put "1)appointed"
put "2)elected"
put "3)men"
get decision20
case decision20 of
label 1 :
put "Yes!"
count2 := count2 + 1
label 2 :
put "Wrong! it's 1"
label 3 :
put "Wrong! it's 1"
end case
put "3.The Executive brnach consists of the.."
put "1)governor general/queen,prime minister,public service,courts"
put "2)governor general/queen,prime minister,public service,cabinet"
put "3)governor general/queen,prime minister,public service,senete"
get decision21
case decision21 of
label 1 :
put "Wrong! it's 2"
label 2 :
put "Yes!"
count2 := count2 + 1
label 3 :
put "Wrong! it's 2"
end case

put "4.The governor general is the.."
put "1)head of Canada"
put "2)head of nation"
put "3)head of state"
get decision22
case decision22 of
label 1 :
put "Wrong! it's 3"
label 2 :
put "Wrong! it's 3"
label 3 :
put "Yes!"
count2 := count2 + 1




end case
put "5.The prime minister is usually the leader of a.."
put "1)political party"
put "2)province"
put "3)the world"
get decision23
case decision23 of
label 1 :
put "Yes!"
count2 := count2 + 1
label 2 :
put "Wrong! it's 1"
label 3 :
put "Wrong! it's 1"
end case
put "6.The highest court in_____is the ________"
put "1)Canada,Super Court"
put "2)Toronto,Superior Court"
put "3)Canada,Supreme Court"
get decision24
case decision24 of
label 1 :
put "Wrong! it's 3"
label 2 :
put "Wrong! it's 3"
label 3 :
put "Yes!"
count2 := count2 + 1
end case
put "7.The House of Commons, and the senete are part of the _______branch"
put "1)executive"
put "2)legislative"
put "3)judicial"
get decision25
case decision25 of
label 1 :
put "Wrong! it's 2"
label 2 :
put "Yes!"
count2 := count2 + 1
label 3 :
put "Wrong! it's 2"
end case
put "8.The courts system interprets laws"
put "1)True"
put "2)False"
get decision26
case decision26 of
label 1 :
put "Yes!"
count2 := count2 + 1
label 2 :
put "Wrong! it's ture"

end case
put "9.Cabinet solidarity is when behind closed doorsthe cabinet"
put " debates issues, but once a decisionis made, in public"
put "the cabinet must support the decision."
put "1)True"
put "2)False"
get decision27
case decision27 of
label 1 :
put "Yes!"
count2 := count2 + 1
label 2 :
put "Wrong!it's true"

put "10.The prime minister's voted for by the public"
put "1)True"
put "2)False"
get decision28
case decision28 of
label 1 :
put "Wrong! it's false"
label 2 :
put "Yes!"
count2 := count2 + 1
end case
put "11.The public service is also called the Civil Service"
put "1)True"
put "2)False"
get decision29
case decision29 of
label 1 :
put "Yes!"
count2 := count2 + 1
label 2 :
put "Wrong!it's true"
end case
put "12.Civil Servants get paid out of taxes"
put "1)True"
put "2)False"
get decision30
case decision30 of
label 1 :
put "Wrong! it's false"
label 2 :
put "Yes!"
count2 := count2 + 1
put "13.The question period is where the opposition"
put "can raise concerns and questions"
put "1)True"
put "2)False"
get decision31
case decision31 of
label 1 :
put "Yes!"
count2 := count2 + 1
label 2 :
put "Wrong!it's false"


end case
put "14.It's hard for the speaker of the house to be impartial"
put "1)True"
put "2)False"
get decision32
case decision32 of
label 1 :
put "Yes!"
count2 := count + 1
label 2 :
put "Wrong! it's true"

put "15. The prime minister holds the real political power"
put "1)True"
put "2)False"
get decision33
case decision33 of
label 1 :
put "Yes!"
count2 := count2 + 1
label 2 :
put "Wrong! it's true"
end case


end case
label 3 :
cls
fontcourier := Font.New ("Courier New:18:")
assert fontcourier > 0

Font.Draw ("FEDERAL AND PROVINCIAL RESPONSIBILITIES", maxx div 2, maxy - 10, fontcourier, 12)

end case



end case
end if
end loop
end if
end if
end if


end if
end if
end if
end case
end loop
end if
Dan




PostPosted: Sun May 18, 2003 6:39 pm   Post subject: (No subject)

sory i did not see that the problem is that you have a lable for the 1st case in an if that was declaed in a lable for the 1st case, with you can not do.

this will give you the same error:

code:

case "g" of
    label "a" :

        if "y" = "z" then
        label "g" :
        end if
end case


you cant use an if like that Confused
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: