online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#import math menu = { 1: { "name": "Big Mac meal", "price": 4.87 } , 2: { "name": "Quarter Pounder meal", "price": 5.03 } , 3: { "name": "Chicken Nuggets meal (5 pieces)", "price": 5.50 } , 4: { "name": "Chicken Nuggets meal (10 pieces)", "price": 9.45 } , 5: { "name": "Apple Pie", "price": 1.29 } , 6: { "name": "Large Drink", "price": 2.19 } , 7: { "name": "Large Fries", "price": 2.29 } } tax = .0565 def review(order, menu = menu): if len(order) == 0: print("No items yet.") return {} print("{:>6s} {:>8s} {:40s} {:>11s}".format("item", "quantity", "item name", "total price")) totalSum = 0 totalItems = 0 for i in order: itemPrice = menu[i]["price"]*order[i] totalSum += itemPrice totalItems += order[i] print("{:>6d} {:>8d} {:40s} {:>11.2f}".format(i, order[i], menu[i]["name"], itemPrice)) print("{:>6s} {:>8s} {:>40s} {:>11s}".format("", "", "", "-----------")) print("{:>6s} {:>8d} {:>40s} {:>11.2f}".format("", len(order), "GRAND TOTAL", totalSum)) return {"totalSum": totalSum, "totalItems": totalItems} sales = { "count": 0, "sum": 0, "items": 0 } order = {} while True: print("Inform item number to add to order.") print("Send R to Review Order.") print("Send C to Close Order.") print("Send E to End Shift.") print("{:>6s} {:40s} {:>5s}".format("item", "item name", "price")) for i in menu: print("{:>6d} {:40s} {:>5.2f}".format(i, menu[i]["name"], menu[i]["price"])) choice = input("Inform your choice and hit Enter: ") if choice.upper() == "E": break elif choice.upper() == "R": review(order) input("Press any key to continue... ") elif choice.upper() == "C": res = review(order) choice = input("Press any key to confirm os send X to cancel: ") if choice != "X": sales["count"] += 1 sales["sum"] += res["totalSum"] sales["items"] += res["totalItems"] order = {} else: try: choice = int(choice) except: print("Invalid choice. Restarting the order.") continue quantity = input("Enter the amount of {} you want or hit Enter for 1: ".format(menu[i]["name"])) try: quantity = int(quantity) if len(quantity) > 0 else 1 except: print("Invalid quantity. Ignoring the item.") continue if choice not in order: order[choice] = 0 order[choice] += quantity print ("{:40s} {:>10d}".format("Total number of sales:", sales["count"])) print ("{:40s} {:>10.2f}".format("$ sales (with tax):", sales["sum"])) print ("{:40s} {:>10.2f}".format("$ sales (without tax):", sales["sum"]-(sales["sum"]*tax))) print ("{:40s} {:>10d}".format("Number of items sold:", sales["items"])) #M# Bic Mac sales from a GDB question

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