Wyo C++ - Ch. 4 Worksheet #1 Name -

1. List of 5 valid identifiers (variable names) that can be used as legal variable names. Make sure that you also follow the conventions discussed in class such as beginning a variable name with a lowercase letter and beginning successive words with a capital letter.

 

2. Write 3 example declaration statements that do not initialize the variables being declared. Use a different data type in each statement.




3. Write 3 example initialization statements that declare AND initialize the variables. Use a different data type in each statement.

 

 

4. Write 3 example assignment statements. Use variables that would be different data types in each statement.

 

 

5. On the back of this worksheet paper, write a full, working C++ program that declares integer (int) variables named wins, losses, and ties. Initialize each one to the value of 0 using initialization statements. The program should then print an output message along with the value of each variable. Make sure that you include a variable dictionary (that is, an inline comment explaining the purpose of each variable in its declaration statement.)

 

6. On the back of this paper, modify the program that you wrote in Exercise 2 so that a variable named totalPoints is assigned the value of wins plus ties. Make sure that the program prints an additional output message along with the value of totalPoints.