CS 110A Lecture Notes - Data Types, Output, and Calculations (Chapter 2)

Console Output

Identifiers (Programmer-Defined Symbols)

Variables

firstVars.cpp: Here is an example demonstrating the use of variables in output.

In-class exercise: Write a program to output today's date, using at least two integer variables.

date.cpp: Solution to in-class exercise to output today's date, using at least two integer variables.

Data Types

Calculations, Assignments, Formatting Text

Programming Style

calcDemo.cpp: Here is an example demonstrating how variables and data types work in calculations.

In-class exercise: Write a program using at least 3 variables to calculate and output the average of the following three test grades: 90, 81.2, and 88.77

Solution to above exercise: gradeAverage.cpp

Return to CS 110A page