online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
''' Coding demonstration for the different uses of for loops in Python 10/12/2021 -Dr. G Note: Don't just copy the code. Don't program by accident. ''' def main(): #Count controlled loops ##Print the numbers 0 - 9 print("\n") #Iterating over a list ##iterate over the string "Roux Institute" and print each letter separated ##by a space print("\n") ##iterate over the string "ZZCZZaZZtZ'Zs Zin tZhZe cZradZleZZ" print the ##results but omit 'Z' print("\n") ##iterate over this list printing each element list1=[44,66,77,88] print("\n") ##Take the string "This is a test" and split it by space print("\n") #Range over a list list2=[88,443,4533,2,454] ##print each element in list2 one at a time using an index ##what's the difference in this and the previous method? print("\n") ##sum all the elements up in list2 result = 0 print(result) ##zero off list2 and print print(list2) #changing steps print("\n") ##print increments of 10 from 0 to 100 ##print list two, but backwards #nesting for loops ##print a square of numbers using grid coordinates 0-0 through 9-9 print("\n") ##iterate over this array printing it as a grid list3 = [[0,1,2,3],[4,5,6,7]] #From Questions of the day ##Counting while loops are loops that run until a certain value is met ##You can predict the number of times it will run ''' count = 0 while (count < 10): print(count) count +=1 ''' ##Sentinel while loops are loops that are "guarded" by a sentinel values ##The number of iterations are not predictable ''' selection = 1 while(selection != 0): selection = int(input("Please enter a value :")) ''' ##A for loop can replace a counting while loop, but shouldn't replace a sentinel ##while loop. ##Rewrite the first example with a for loop ##We don't typically use counting while loops unless there a very specific reason ##to do so. For example, if you want to end the while loop early under certain circumstances. ##Even then you could use a break with a for loop. main()

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