online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
candle = 0 apple = 0 horse = 0 string = 0 ring = 0 fathermoney=0 coin=0 score=0 feather=0 necklace=0 fruitbowl = 0 marblesack = 0 book = 0 speechpoints = 0 sawbarker = False gavemarbles = 0 print ("Cool Cousins Studios Presents...") import time time.sleep(2) # Sleep for 2 seconds print ("With use of Python Code...") time.sleep(2) # Sleep for 2 seconds print ("Adventure In Saldica") time.sleep(2) # Sleep for 2 seconds print ("(cue dramatic music)") time.sleep(3) # Sleep for 3 seconds # intro branch options number = int(input("1 for house 2 for field 3 for stable. Enter a number: ")) if number == 1: print ("Inside the house there is a sweet aroma of rolls being baked."); number = int(input("1 for your room 2 for kitchen 3 for main room. Enter a number: ")) if number == 1: print ("Your room is pretty plain, but at least you have your own. A bed stands in the corner, and a small, crude dresser sits under the window.") number = int(input("1 for bed 2 for dresser 3 for window. Enter a number: ")) if number == 1: print ("Your bed is comfortable and warm. The pillow is stuffed with feathers from the chickens.") number = int(input("1 for sleep 2 for don't sleep. Enter a number: ")) if number == 1: print ("Your bed is comfortable and warm. You are soon fast asleep. in the morning, you get up and go outside... (restart game)") import sys sys.exit() elif number == 2: print ("Your father knocks on your door, asking you if you can deliver some vegitables to town for him.") else: print ("oops! wrong number! Please start over") import sys sys.exit() elif number == 2: print ("The dresser contains your clothes, since you don't have a closet. A candle and a book you are reading sit on top of it.") number = int(input("1 for candle 2 for outside. Enter a number: ")) if number == 1: print ("You take the candle. As you do, your father comes into the room and asks you if you can deliver some vegitables to town for him.") candle = 1 elif number == 2: print ("As you turn to leave the room, your father enters and asks you if you can deliver some vegitables to town for him.") else: print ("oops! wrong number! Please start over") import sys sys.exit() elif number == 3: print ("This is your window. Your room is on the second story of your house, and there is a tree growing outside that you sometimes use to go in and out of your room.") number = int(input("1 for tree 2 for leave room. Enter a number: ")) if number == 1: print ("You climb down the tree. At the bottom your father sees you and asks you if you can deliver some vegitables to town for him.") elif number == 2: print ("As you turn to leave the room, your father enters and asks you if you can deliver some vegitables to town for him.") else: print ("oops! wrong number! Please start over") import sys sys.exit() else: print ("oops! wrong number! Please start over") import sys sys.exit() elif number == 2: print ("Mom has set out her delicious rolls to cool and has left the room. there are cupboards, a large table, and an oven inside the room") number = int(input("1 to eat rolls 2 for cupboards 3 for table. Enter a number: ")) if number == 1: print ("Your Mother catches you eating the rolls. She admonishes you and sends you to bed early. The next morning, you go outside...(re-play game)") import sys sys.exit() elif number == 2: print ("Inside the cupboard there is a stale crust and an apple. You take the apple. You are about to eat it when your father enters the room and asks you if you can deliver some vegitables to town for him.") apple = 1 elif number == 3: print ("You sit at the table and wait. Pretty soon you mother, father, and little brother come in and everyone gets to eat mother's delicious rolls for breakfast. after everyone finishes eating your father asks you to deliver some vegitables to town for him.") else: print ("oops! wrong number! Please start over") import sys sys.exit() elif number == 3: print ("Your father takes a break from his work in the chair, which is the only thing besides a low table that furnishes the room. Of course the fireplace is there too.") number = int(input("1 for Father 2 for fireplace 3 to leave the room. Enter a number: ")) if number == 1: speechpoints += 2 print ("You ask you father how he is doing. He says his work is hard, but he is doing well. He asks you if you can deliver some vegitables to town for him.") elif number == 2: print ("The fireplace is cold now, but it burns brightly at night when everyone gathers to say prayers. Your father says good morning, and asks you if you can deliver some vegitables to town for him.") elif number == 3: print ("As you leave through the side door, your father stops you and asks you if you can deliver some vegitables to town for him.") else: print ("oops! wrong number! Please start over") import sys sys.exit() else: print ("oops! wrong number! Please start over") import sys sys.exit() elif number == 2: print ("Grass swishes as you walk through it. a solitary horse is grazing in the field.") number = int(input("1 for horse 2 for path 3 for the sky. Enter a number: ")) if number == 1: print ("Your family owns quite a few horses, but you own this one. You love to ride it.") number = int(input("1 to ride 2 to go inside. Enter a number: ")) if number == 1: print ("You saddle your horse and get on it. As you start to ride down the path your father stops you and asks you if you can take some vegitables to town for him.") horse = 1 elif number == 2: print ("Your Father greets you as you walk inside and asks you if you can take some vegitables to town for him.") else: print ("oops! wrong number! Please start over") import sys sys.exit() elif number == 2: print ("this is the path leading to town.") number = int(input("1 to go down the path 2 to go back inside. Enter a number: ")) if number == 1: print ("You are about to walk down the path when your father comes up to you and asks you if you can deliver some vegitables to town for him.") elif number == 2: print ("As you head back to your house, your father comes out and asks you if you can deliver some vegitables to town for him.") else: print ("oops! wrong number! Please start over") import sys sys.exit() elif number == 3: print ("you look up at the sky. as you stand there looking up at the sky lightning suddenly strikes you and you die. How inconvinient. (game over)") import sys sys.exit() else: print ("oops! wrong number! Please start over") import sys sys.exit() elif number == 3: print ("you are greeted by the sound of various animal noises and the smell of various animal odors") number = int(input("1 for chickens 2 for pigs 3 for cow. Enter a number: ")) if number == 1: print ("You feed the chickens. They all rush twards their food exept for one that stands in the back.") number = int(input("1 for alone chicken 2 for outside Enter a number: ")) if number == 1: print ("To your surprise the chicken speaks to you, telling you that his name is jeffthechicken and demanding that you let him out of this cage.") number = int(input("1 to let him go 2 to not Enter a number: ")) if number == 1: print ("Jeffthechicken is very pleased with you and gives you one of his feathers as a token of thanks. Your father is angry when he sees that you released a chicken, and asks you to deliver some vegitables to town for him to make up for it.") feather = 1 elif number == 2: print ("Before you even can say no, jeffthechicken has changed the coding of the game, giving you a bad ending. (game over)") import sys sys.exit() else: print ("oops! wrong number! Please start over") import sys sys.exit() elif number == 2: print ("As you leave the stables, you meet your father, who is wondering if you can deliver some vegitables to town for him.") else: print ("oops! wrong number! Please start over") import sys sys.exit() elif number == 2: print ("The pigs nod in thanks for their meal before messily devouring it. As you watch them eat, your father enters the stables, asking if you could deliver some vegitables to town for him.") elif number == 3: print ("You milk the cow. 'Ol Bessie is very quiet and timid, which makes the job easy. Your father enters the stables, asking if you could deliver some vegitables to town for him.") else: print ("oops! wrong number! Please start over") import sys sys.exit() else: print ("oops! wrong number! Please start over") import sys sys.exit() #father vegitable decisions number = int(input("1 for yes 2 for no 3 for cow. Enter a number: ")) if number == 1: if horse == 1: global horsename horsename = input("Type a name for your (female) horse: ") print ("You ride on",horsename,"while she pulls the cart of vegitables.") else: print ("you push the cart full of your father's vegitables onto the path leading to town.") elif number == 2: print ("How lazy of you.(game over)") import sys sys.exit() elif number == 3: print ("sorry, I had to put that there.") number = int(input("1 for yes 2 for no. Enter a number: ")) if number == 1: if horse == 1: horsename = input("Type a name for your (female) horse: ") print ("You ride on",horsename,"while she pulls the cart of vegitables.") else: print ("you push the cart full of your father's vegitables onto the path leading to town.") elif number == 2: print ("How lazy of you.(game over)") import sys sys.exit() else: print ("oops! wrong number! Please start over") import sys sys.exit() else: print ("oops! wrong number! Please start over") import sys sys.exit() #road travel number = int(input("1 for side of the road 2 for keep going: ")) if number == 1: print ("There is nothing on the side of the road exept for the ditch. across the ditch there is a forest on either side of the road.") elif number == 2: print ("You keep trudging along.") else: print ("oops! wrong number! Please start over") import sys sys.exit() number = int(input("1 for side of the road 2 for keep going: ")) if number == 1: print ("You find a piece of string and pick it up. There is nothing else on the side of the road exept for the ditch. across the ditch there is a forest on either side of the road.") string = 1 elif number == 2: print ("You keep trudging along.") else: print ("oops! wrong number! Please start over") import sys sys.exit() number = int(input("1 for side of the road 2 for keep going: ")) if number == 1: print ("There is nothing on the side of the road exept for the ditch. across the ditch there is a forest on either side of the road.") elif number == 2: print ("You keep trudging along.") else: print ("oops! wrong number! Please start over") import sys sys.exit() number = int(input("1 for side of the road 2 for keep going: ")) if number == 1: print ("There is nothing on the side of the road exept for the ditch. across the ditch there is a forest on either side of the road.") elif number == 2: print ("You keep trudging along.") else: print ("oops! wrong number! Please start over") import sys sys.exit() number = int(input("1 for side of the road 2 for keep going: ")) if number == 1: print ("There is nothing on the side of the road exept for the ditch. across the ditch there is a forest on either side of the road.") elif number == 2: print ("You pass Mr Barker. He is coming from town and looks dejected.") sawbarker = True else: print ("oops! wrong number! Please start over") import sys sys.exit() number = int(input("1 for side of the road 2 for keep going: ")) if number == 1: print ("You find a ring covered in dust. There is nothing else on the side of the road exept for the ditch. across the ditch there is a forest on either side of the road. You have reached town.") ring = 1 elif number == 2: print ("You have reached town.") else: print ("oops! wrong number! Please start over") import sys sys.exit() #in town decisions number = int(input("1 for shop 2 for merchant: ")) if number == 1: if horse == 1: print (horsename,"brings the cart up to the shopkeeper, who thanks you for the delivery.") else: print ("You bring the cart to the shop. the shopkeeper thanks you for the delivery.") number = int(input("1 for shopkeeper 2 for merchant. Enter a number: ")) if number == 1: print ("You remind the shopkeeper to pay you. He apologies and gives you the money. You put all of it exept for one coin in your pocket, which your father told you you could spend on anything you want.") fathermoney = 1 coin += 1 speechpoints += 1 print ("You walk up to the merchant's stand. He says hello and asks you if you would like to trade anything.") elif number == 2: print ("You walk up to the merchant's stand. He says hello and asks you if you would like to trade anything.") else: print ("oops! wrong number! Please start over") import sys sys.exit() elif number == 2: print ("You walk up to the merchant's stand. He says hello and asks you if you would like to trade anything.") else: print ("oops! wrong number! Please start over") import sys sys.exit() #merchant selling if candle == 1: print ("The merchant asks you if you would like to trade your candle for a coin.") number = int(input("1 for yes 2 for no. Enter a number: ")) if number == 1: print ("The merchant thanks you for trading with him.") coin = coin + 1 candle = 0 if apple == 1: print ("The merchant asks you if you would like to trade your apple for a coin.") number = int(input("1 for yes 2 for no. Enter a number: ")) if number == 1: print ("The merchant thanks you for trading with him.") coin = coin + 1 apple = 0 if ring == 1: if string == 1: print ("The merchant asks you if you would like to trade your ring and string for 3 coins.") number = int(input("1 for yes 2 for no. Enter a number: ")) if number == 1: print ("The merchant thanks you for trading with him.") coin = coin + 3 ring = string = 0 if ring == 1: print ("The merchant asks if you would like to trade your ring for a coin.") number = int(input("1 for yes 2 for no. Enter a number: ")) if number == 1: print ("The merchant thanks you for trading with him.") coin = coin + 1 ring = 0 if feather == 1: print ("The merchant sees your feather and asks if you if he could hold it. He then asks you if you would like to trade your feather for 3 coins.") number = int(input("1 for yes 2 for no. Enter a number: ")) if number == 1: print ("The merchant thanks you for trading with him, and with shaking hands carefully puts the feather in a box and locks it up.") coin = coin + 3 feather = 0 #merchant buying m=9 print ("The merchant shows you his wares. You have",coin,"coins. (don't use more than you have)") print ("The merchant has:") print ("A necklace: 5 coins") print ("A bowl of fruit: 3 coins") print ("Three sacks of marbles: 2 coins each") print ("A Sequel to the book you are reading: 4 coins") print("would you like to buy the necklace?") number = int(input("1 for yes 2 for no: ")) if number == 1: print ("The merchant thanks you for trading with him.") coin -= 5 necklace = 1 elif number == 2: print ("") else: print ("oops! wrong number! Please start over") import sys sys.exit() print("would you like to buy the bowl of fruit?") number = int(input("1 for yes 2 for no: ")) if number == 1: print ("The merchant thanks you for trading with him.") coin -= 3 fruitbowl = 1 elif number == 2: print ("") else: print ("oops! wrong number! Please start over") import sys sys.exit() print("would you like to buy any marbles?") number = int(input("1 for yes 2 for no: ")) if number == 1: number = int(input("Buy 1,2 or 3: ")) if number > 3: print ("oops! wrong number! Please start over") import sys sys.exit() if number < 1: print ("oops! wrong number! Please start over") import sys sys.exit() print ("The merchant thanks you for trading with him.") coin -= 2*number marblesack = number elif number == 2: print ("") else: print ("oops! wrong number! Please start over") import sys sys.exit() print("would you like to buy the book?") number = int(input("1 for yes 2 for no: ")) if number == 1: print ("The merchant thanks you for trading with him.") coin -= 4 book = 1 elif number == 2: print ("") else: print ("oops! wrong number! Please start over") import sys sys.exit() if coin < 0: print("Oh no! You took more than you could pay for! The merchant has you arrested.") import sys sys.exit() #Mrs. Welloffe conversation m=11 print ("You are walking out of town when mayor Welloffe's wife calls to you from her porch, asking you to come talk to her") number = int(input("1 for 'Okay' 2 for 'I would love to!' 3 for 'NO!!!': ")) if number == 1: print ("You walk to where Mrs. Welloffe is sitting.") elif number == 2: speechpoints += 2 print ("You walk to where Mrs. Welloffe is sitting.") elif number == 3: speechpoints -= 1 print ("Mrs. Welloffe inststs, so you walk over anyways") else: print ("oops! wrong number! Please start over") import sys sys.exit() print ("Mrs. Welloffe asks you how your family is doing.") number = int(input("1 for 'Good' 2 for 'Times are hard, but we're doing pretty well.' 3 for 'None of your business!': ")) if number == 1: print ("Mrs. Welloffe nods civilly.") elif number == 2: speechpoints += 3 print ("Mrs. Welloffe nods sympathetically.") elif number == 3: speechpoints -= 2 print ("Mrs. Welloffe shrugs.") else: print ("oops! wrong number! Please start over") import sys sys.exit() print ("Mrs. Welloffe asks how you are doing.") number = int(input("1 for 'Okay' 2 for 'I'm doing well, thank you!' 3 for 'Also none of your business!': ")) if number == 1: print ("Mrs. Welloffe shrugs.") elif number == 2: speechpoints += 3 print ("Mrs. Welloffe Smiles.") elif number == 3: speechpoints -= 3 print ("Mrs. Welloffe sighs.") else: print ("oops! wrong number! Please start over") import sys sys.exit() print ("Mrs. Welloffe asks if you're enjoying the book she lent you.") number = int(input("1 for yes 2 for No: ")) if number == 1: speechpoints += 1 if book == 1: print ("You tell her that you just bought the sequel.") speechpoints += 4 else: print ("Mrs. Welloffe says she is glad.") elif number == 2: print ("Mrs. Welloffe says she is sorry about that.") else: print ("oops! wrong number! Please start over") import sys sys.exit() print ("Mrs. Welloffe asks you if you have seen Mr. Barker.") number = int(input("1 for yes 2 for No: ")) if number == 1: if sawbarker == True: speechpoints += 3 print ("Mrs. Welloffe explains that he was sad because he is losing his farm.") else: speechpoints -= 2 print ("Mrs. Welloffe explains that he is losing his farm.") elif number == 2: if sawbarker == True: speechpoints -= 2 print ("Mrs. Welloffe explains that he is sad because he is losing his farm.") else: speechpoints += 2 print ("Mrs. Welloffe explains that he is losing his farm.") else: print ("oops! wrong number! Please start over") import sys sys.exit() print ("Mrs. Welloffe says goodbye and wishes you luck.") number = int(input("1 for 'Whatever.' 2 for 'You too!': ")) if number == 1: speechpoints -= 1 print ("Mrs. Welloffe has already gone inside.") elif number == 2: speechpoints += 2 print ("Mrs. Welloffe Smiles and goes inside.") else: print ("oops! wrong number! Please start over") import sys sys.exit() #road to home m=20 number = int(input("1 for side of the road 2 for keep going: ")) if number == 1: print ("There is nothing on the side of the road exept for the ditch. across the ditch there is a forest on either side of the road.") elif number == 2: print ("You keep trudging along.") else: print ("oops! wrong number! Please start over") import sys sys.exit() number = int(input("1 for side of the road 2 for keep going: ")) if number == 1: print ("There is nothing on the side of the road exept for the ditch. across the ditch there is a forest on either side of the road.") elif number == 2: print ("You keep trudging along.") else: print ("oops! wrong number! Please start over") import sys sys.exit() number = int(input("1 for side of the road 2 for keep going: ")) if number == 1: print ("There is nothing on the side of the road exept for the ditch. across the ditch there is a forest on either side of the road.") elif number == 2: print ("As you trudge along, a carrage speeds by. A coin is dropped out a ways down the road, and you pick it up.") coin += 1 else: print ("oops! wrong number! Please start over") import sys sys.exit() number = int(input("1 for side of the road 2 for keep going: ")) if number == 1: print ("There is nothing on the side of the road exept for the ditch. across the ditch there is a forest on either side of the road.") elif number == 2: print ("You keep trudging along.") elif number == 49: coin += 10 print ("Something in the forest catches your eye. You struggle across the ditch, and a little into the forest you find 10 coins under a sign that reads: 'Well this is surprising. 49 wasn't one of the options. Oh well. Here, have these coins.' You wonder if this means the coins are for you. When you look up at the sign again it says: 'Who else would they be for?' You decide to take the coins. As you head back to the path, you take one last glance at the sign, which now reads: 'And yes, I can read your mind.' You make your way back to the path and keep trudging along.") else: print ("oops! wrong number! Please start over") import sys sys.exit() number = int(input("1 for side of the road 2 for keep going: ")) if number == 1: print ("There is nothing on the side of the road exept for the ditch. across the ditch there is a forest on either side of the road.") elif number == 2: print ("You keep trudging along.") else: print ("oops! wrong number! Please start over") import sys sys.exit() number = int(input("1 for side of the road 2 for keep going: ")) if number == 1: print ("There is nothing on the side of the road exept for the ditch. across the ditch there is a forest on either side of the road. You have reached your home.") elif number == 2: print ("You have reached your home.") else: print ("oops! wrong number! Please start over") import sys sys.exit() #brother kindness option m=31*21 if marblesack > 0: print ("As you walk to your house, your brother runs up and greets you, asking if you brought anything back for him.") number = int(input("1 to give him the marbles 2 to not: ")) if number ==1: print ("Your brother is delighted with his gift and runs inside to show your mom.") gavemarbles = 1 marblesack = 0 elif number == 2: print ("You brother walks back to the house, looking disappointed.") speechpoints -= 1 else: print ("oops! wrong number! Please start over") import sys sys.exit() #Fathermoney m=31*21 import math score = (math.floor(speechpoints*0.5)+(2*gavemarbles)+candle + apple + (3*horse) + ring + (2*fathermoney) + coin + (2*feather)+(5*necklace)+(4*fruitbowl)+(5*book)+marblesack) print ("THE END") print ("your score is:",score,"!") print ("Credits: everything: me.")

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue