online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
# A function is a block of code that can be easily named and reused elsewhere # In python the format for writing a function is # def functionName(parameters): # To make it easier to understand, let's look at an example def addTen(number): return number + 10 # The word "return" is used to send a value back to the code # or terminate function once it is complete # This is what executing a function looks like # Hit run and see what the result is num = 35 print("Running addTen: " + str(addTen(num)) + "\n") # Notice that placeholder "number" var is used throughout the function definition # But when we execute it, we use a variable that we have a value for, "num" # Here is another example using if statements # Note that this does not require a return statement def largeCheck(number): if(number > 100): print("This is a large number\n") else: print("This is not a large number\n") print("Running largeCheck(" + str(num) + "): ") largeCheck(num) # Try changing the value sent to largeCheck(number) to get the other print statement to execute # Below, complete the function doubleList, which should double the value of each list entry if they are greater or equal to 100 # Feel free to use the list given below, or make your own to test myList = [1, 10, 50, 100, 300, 500.75] def doubleHighList(numList): # Type code to double each value in the list here return numList print("Doubled High List:") print(doubleHighList(myList))

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