Question: C + + Basics Worksheet peclaration and Initialization Give the declaration for two variables called feet and inches. Both variables are of type int and

C++ Basics Worksheet
peclaration and Initialization
Give the declaration for two variables called feet and inches. Both variables are of type int and both are to be initialized to zero in the declaration. Use both initialization alternatives.
Give the declaration for two variables called count and distance. count is of type int and is initialized to zero. distance is of type double and is initialized to 1.5.
Assignment
3. Give a C++ statement that will change the value of the variable sum to the sum of the values in the variables n1 and n2. The variables are all of type int.
4. Give a C++ statement that will increase the value of the variable length by 8.3. The variable length is of type double.
5. Give a C++ statement that will change the value of the variable product to its old value multiplied by the value of the variable n. The variables are all of type int.
6. Which of the following are valid C++assignment statements? Assume that i,x, and percent are double variables.
a.i=i+5;
b.x+2=x;
c.x=2.5**x;
d. percent =10%;
Identifiers and Reserved Words(keywords)
7. Which of the following are valid identifiers:
4th new-file file23 C++Program3 New_File 1_file
8. Give good variable names for each of the following:
a. A variable to hold the speed of an automobile
b. A variable to hold the pay rate for an hourly employee
c. A variable to hold the highest score in an exam
9. Which of the following is a reserved word (keyword) in C++?
a. Const
b. Include
c. Char
d. return
e. void
f. int
g. Return
10. What is the difference between a keyword and a user-defined identifier?
 C++ Basics Worksheet peclaration and Initialization Give the declaration for two

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!