Contact: choi at belmonthill dot org
Extra problems that could be used for AP CS Principles. Includes problem descriptions and check50 files. Sample solutions will be posted elsewhere (email for link).
Recommended order of assignments and topics:
-
add_two_numbers: Simple assignment after "Hello, World". Ask user for two numbers and return the sum. Topics: variables, printf(), get_int()
-
mad_libs: Ask user for a float, int, string, char. Combine them into a humorous output with printf() statements. Topics: get_int() etc., printf()
-
multiples: Ask the user to enter a number and a divisor. Then print out multiples less than or equal to that number. Topics: loops
-
loops: Ask user for a number to count to from 1 to that number. Implement with a for loop. Ask user for another number between 0 and 12 and recite the multiplication table up to 12 for that number. Implement with a while loop. Topics: loops
-
fahrenheit: Slight modification of the CS50 assignment. Implement Fahrenheit to Celsius conversion and vice versa using functions. Topics: do-while loop, functions
-
geometry: Create functions to calculate area or perimeter of a square, triangle, and rectangle. Create a program that will ask the user which formula he/she would like to calculate, ask the lengths to use, and output the result. Topics: do-while loop, functions
-
lottery: Create a program that will draw the winning numbers, and then simulate drawing 100,000 lottery tickets. Keep track of how many tickets matched exactly 1 number, exactly 2, etc. and in a final print out display the percentage for each. Topics: arrays, rand()