all programming languages:
4. make decisions
all used in functions, best at repeating
function = named procedure that performs a distinct service
independent of main code
chapter 3.1-3.2 notes
boolean expression = value is always true or false
boolean variable (bool) = data type to store value of boolean expression
b = true;
b = (mpg > GOOD_MPG);
b = (5 > 6);
b = (5 = 5);
chapter 2.3 notes
variables in memory
label value location
first available space
look up by label
CPU - small & fast, brain of computer
Problem : How are enumerated types useful?
Enumerated types are used to create new data types that have a finite range of possible
values. A color type lends itself to an enum definition with values such ascfw_RED, ORANGE,
YELLOW, GREEN, BLUE, INDIGO, PUR
Programming is essentially the manipulation of many variables. The basic variable data
types which C+ variables can assume are: int (integers), char (characters)
and doubles (real decimals). Declaring a variable simply means letting the computer know
You can also easily create your own header files for use in your programs if you want to be
able to reuse your code or want to better organize your programs.
Above the #include line is a comment. C+ will completely ignore anything you write after
#include - The #include command tells the compiler to use the specified header file as part
of your program.
Header File - A file ending in .h which contains definitions of variables, classes, and
functions that may be useful in your code.
Syntax - The us
C+ is a computer programming language that supports object-oriented programming,
meaning it is largely concerned with the manipulation of special variables called objects.
Classes are used to create objects, but before learning about them it is essential
Problem : What is the purpose of the #include statement in a C+ program?
The #include statement tells the C+ preprocessor to insert the definitions of variables,
classes, and functions into the current file. #include <iostream.h>, for example, lets you
There are more primitive data types in C+ which are variation on the ones described above.
They are as follows:
unsigned char - takes non-negative values twice as high as normal chars.
unsigned int - similarly, takes on non-negative values up to twice t
String - A sequence of characters, usually represented between quotation marks. E.g.:
"There are 42 characters in this sentence.\n"
Constant - A constant is a variable whose value does not change for the duration of a
program. To create a constant, declar
Class Template - A class which has one or more data members (and functions) of some
unspecified data type. By defining a template, the programmer can create an object using
any data type or types.
Composition - Composition is the use of an object as a mem
Problem : Why are there different data types?
Different data types are used for different types of values. If you are trying to represent
something with discrete values (i.e. something you might count), integers are usually useful.
If the numbers require
Private - Functions and variables to which only the class member functions (and friends)
Public - Functions, and rarely non-constant variables, that are directly accessible through
Protected - The protected keyword behaves the same
Comp11 Wass3 Chapter 5 2. decrement 4. Postfix 6. iteration 8. posttest 10. counter 12. loop control variable 14. for 16. while and for 18. nested 20. break 32. 2345678910 34. $9999 $9999 $9999 36. A) num = bigNum Num *= Bignum The result should be n