introduction to pass, and exercises on operators and basic i/o

Click here to load reader

Upload: branden-terry

Post on 12-Jan-2016

223 views

Category:

Documents


0 download

TRANSCRIPT

Introduction to Programming

Introduction to PASS, and Exercises on Operators and Basic I/OLab 3

32. Exercises on Operators and Basic I/OQ1a. Download area.cpp file from the course website. There are syntax/logical errors in this area.cpp file, please correct them.

Program reads the width and height of a rectangle. The program computes and output the area of the rectangle. Is the program easy to understand? Why?

52. Exercises on Operators and Basic I/OQ1b. Revise program to print notes for the input and output of the program

Test your program using PASS

Q1c: Improve the programming style of the programMore meaningful variable name to reflect the purpose of the variableIndentation (use the tab character to indent)Add comments;62. Exercises on Operators and Basic I/OQ2a: Body Mass Index (BMI)Read the weight and height of a person

Calculate and print the Body Mass Index (BMI)

Test your program using PASS72. Exercises on Operators and Basic I/O

- Consider the data type needed, int or double? - To print to 2 decimal places, you may use cout