Programming Sprints to Try
Prompts:
- Program 1: prints a user-inputted number
- Program 2: prints sum of two user-inputted numbers
- Variation 1 entirely in
main
- Variation 2, with a function responsibly for entering a number,
enterNumber
- Variation 3, with two functions,
enterNumber
andgetSum
- Variation 1 entirely in
- Program 3: prints quotient and remainder of two user-inputted numbers
- Variation 1 entirely in
main
- Variation 2, with two function,
getQuotient
andgetRemainder
- Variation 3, with a function
getSolution
which returns a vector containing quotient and remainder
- Variation 1 entirely in
- Program 4: prints whether a user-inputted year is a leap year
- Variation 1 entirely in
main
- Variation 2 entirely in
main
, but checks if a valid year is entered - Variation 3 entirely in
main
, but continues asking until a valid year is entered
- Variation 1 entirely in
- Program 5: prints the
10
x10
multiplication table - Program 6: checks if a user-inputted char is a vowel or consonant
- Variation 1, with an
if
statement - Variation 2, with an array
- Variation 3, with a vector
- Variation 4, with a function responsible for vowel-checking
- Variation 1, with an
- Program 7: counts how many vowels and how many consonants in an entered sentence
- Variation 1, with
isVowel
function - counts non-letters as consonants - Variation 2, considers only letters by checking ASCII ranges in
isLetter
function - Variation 3, considers only letters by
isalpha
function inisLetter
function
- Variation 1, with
Program 1
Write a program that prints a number entered by the user. (5 minutes)