Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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?
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions