Programming Sprints to Try

To practice and develop your C++ fluency, try these programming sprints.

Prompts:

  • Program 1: prints a user-inputted number
  • Program 2: prints sum of two user-inputted numbers
  • Program 3: prints quotient and remainder of two user-inputted numbers
    • Variation 1 entirely in main
    • Variation 2, with two function, getQuotient and getRemainder
    • Variation 3, with a function getSolution which returns a vector containing quotient and remainder
  • 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
  • Program 5: prints the 10 x 10 multiplication table
  • Program 6: checks if a user-inputted char is a vowel or consonant
  • 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 in isLetter function

Program 1

Write a program that prints a number entered by the user. (5 minutes)

Structs

What is a data structure? How do we create our own structures? What can we do with them?

A data structure is several data elements grouped together under one name. These data elements are also known as members or variables of different types and sizes. Data structures, aka structs for short, can be declared in C++ using the following syntax:

struct StructName {
	member_type1 member_name1;
	member_type2 member_name2;
	member_type2 member_name2;
	...
};

CA 4 - Jeopardy Game

An in-class activity assigned Wednesday, 04/24/2019. Due Mon, Apr. 29 in class or via submission portal

Write a Jeopardy-style C++ game that includes the following elements:

  • A data structure for the Jeopardy Host (at least 3 attributes) [Update]: removed this requirement
  • A data structure for a Jeopardy Question
  • at least 5 instances of a Question
  • a menu that lets you select a question

Pagination


© 2020. Some rights reserved.