if flag then x := 0 else x := 1 end if
VC The client preferred vinegar, crinkled chips
BR The client preferred bar-b-que, regular chips
VT The client preferred vinegar chips
BC The client preferred bar-b-que, crinkled chips
CV The client preferred other chips
V The client preferred vinegar chips
if p and q then put "Both true" elsif p and not q then put "Only first true" elsif not p and q then put "Only second true" else put "Neither true" end if
if a < b then if b <= c then put "Values are in order" else put "Values are out of order" end if elsif a > b then if b >= c then put "Values are in order" else put "Values are out of order" end if else put "Values are in order" end if
% Assuming only lower case letters, otherwise you need to add the capitals case currChar of label 'a','e','i','o','u' : charType := 'V' label 'b','c','d','f','g', 'h','j','k','l','m', 'n','p','q','r','s', 't','v','w','x','y', 'z' : charType := 'C' label '0','1','2','3','4', '5','6','7','8','9' : charType := 'D' label '.',',',':',';','?', '!','-' : charType := 'P' label '(',')','\'','"' : charType := 'S' label : charType := 'O' end case
put "currChar was of type ".. case charType of label 'V' : put "vowel" label 'C' : put "consonant" label 'D' : put "digit" label 'P' : put "punctuation mark" label 'S' : put "special character" label 'O' : put "other" label : put "shouldn't be possible" end case
var amount, leftover, penny, nickel, dime, quarter : int var commas : int := -1 put "How much money do we need to make change for (0-99 cents)?" get amount quarter := amount div 25 leftover := amount mod 25 dime := leftover div 10 leftover := leftover mod 10 nickel := leftover div 5 penny := leftover mod 5 if quarter > 0 then commas := commas + 1 end if if dime > 0 then commas := commas + 1 end if if nickel > 0 then commas := commas + 1 end if if penny > 0 then commas := commas + 1 end if put amount, " cents requires ".. case quarter of label 2, 3: put quarter, " quarters".. label 1 : put "1 quarter".. label : end case if commas > 0 and quarter > 0 then put ", ".. commas := commas - 1 end if case dime of label 2: put "2 dimes".. label 1: put "1 dime".. label : end case if commas > 0 and dime > 0 then put ", ".. commas := commas - 1 end if if nickel = 1 then put "1 nickel".. end if if commas > 0 then put ", ".. end if case penny of label 1 : put "1 penny".. label 2, 3, 4: put penny, " pennies".. label : end case put "."