cin and Computation Worksheet
- Write the statements to calculate the area and perimeter of a room.
Your statements should read in the length and the width of the room,
calculate the perimeter, calculate the area, and then print the
length, width, perimeter, and area.
- Write the statements to declare the variables you used in the
previous problem.
- Change your statements for problem 1 so that you read in
the length and width of the room, print the length and width,
calculate the perimeter, print
the perimeter, calculate the area, and print the area.
- Will your program in problem 3 work correctly?
- What if you change your program in problem 3 so that it calculates
the area and perimeter first, before it reads in the length and
the width? Will this version of the program work correctly?
- What are the values of the variables length and width before
the cin statement is executed?
Email Me |
Office Hours |
My Home Page |
Department Home |
MCC Home Page
© Copyright Emmi Schatz 2002