online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
# Computations with Candy Bars import math # Needed for floor/ceil if used later print("This program will help you calculate details about your bag of candy bars.\n") # --- Step 1: Basic info about the candy bars --- candy_name = input("What kind of candy bars do you have? ") print(f"Answer the following questions about your {candy_name} bars.\n") num_bars = int(input("Enter the number of candy bars in a package: ")) weight_per_bar = float(input("Enter the weight (in ounces) of one candy bar: ")) total_weight = num_bars * weight_per_bar print("\nYou have",num_bars,candy_name,"bars.") print("Each bar weighs",format(weight_per_bar,".2f"),"ounces.") print(f"Total weight:",format(total_weight,".2f"),"ounces.") print("\nPerhaps you should consider a healthier snack!\n") # --- Step 2: Calories --- # TODO: Add a variable for calories per bar. # Ask the user for input. # Compute total calories and display the result. # --- Step 3: Bites per bar --- # Assume 1 bite = 0.7 oz. # TODO: Calculate and display: # - Bites per bar # - Total bites for all bars # Example: if a bar is 2.1oz, then 2.1 / 0.7 = 3 bites. # --- Step 4: Burn calories --- # A person burns: # - weight * 0.57 calories per mile walking # - weight * 0.72 calories per mile running # TODO: Ask user for their weight. # Then calculate and display how many miles they need to: # - Walk to burn off 1 bar and the whole package # - Run to burn off 1 bar and the whole package # Include candy bar name in the output.

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