Skill Practice - Chapter 2

Ace your homework & exams now with Quizwiz!

When do preprocessor directives execute?

Before the compiler compiles your program

A group of statements, such as the contents of a function, is enclosed in

Braces { }

The following data: 72 'A' "Hello World" 2.8712 are all examples of

Literals or Constants

A(n) [...] is like a variable, but its value is read-only and cannot be changed during the program's execution

Named Constant

Every complete sentence ends with a [...]

Semicolon

The negation operator is

Unary

Declare a character variable named init

char init;

Declare a character variable named letter

char letter;

Declare a double variable called payCheck

double payCheck;

Declare a double variable called velocity

double velocity;

Declare a float variable called mass

float mass;

Declare a float variable called weight

float weight;

Every C++ program must have a

function main

Declare an integer variable called answer and assign it to 42;

int answer = 42;

Declare an integer variable named count

int count;

Declare an array of 3 integers called grades

int grades[3];

Declare an integer variable called laps and assign it to 7

int laps = 7;

Declare an integer variable named num

int num;

Declare an integer variable named population

int population;

Declare a string variable called sailor and assign it the value Popeye

string sailor = "Popeye";

Preprocessor directives begin with a

#

Declare an array of 10 booleans called passed

bool passed[10];


Related study sets

Chapter 19: Sexual Reproduction and the Power of Genetics

View Set

CIS4341 Security and Risk Chapter 7-8

View Set

Chpt 9 Male Genital W&L 37 Genitourinary system

View Set

Nursing Unit B Practice Questions

View Set

Chapter 5 Key Terms - Business Ethics

View Set