Download presentation
Presentation is loading. Please wait.
Published byBranden Terry Modified over 9 years ago
1
Introduction to PASS, and Exercises on Operators and Basic I/O
3
3 Q1a. Download area.cpp file from the course website. There are syntax/logical errors in this area.cpp file, please correct them.
4
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?
5
5 Q1b. Revise program to print notes for the input and output of the program Test your program using PASS
6
Q1c: Improve the programming style of the program More meaningful variable name to reflect the purpose of the variable Indentation (use the tab character to indent) Add comments; 6
7
Q2a: Body Mass Index (BMI) Read the weight and height of a person Calculate and print the Body Mass Index (BMI) Test your program using PASS 7
8
- Consider the data type needed, int or double? - To print to 2 decimal places, you may use cout<<setprecision(2). - To use setprecision(), you need #include 8
9
Q2b: Body Mass Index (BMI) in pounds 1 kg = 2.21 pounds Test your program using PASS 9
10
Q3: Write a program to converts the input value to Minutes and Seconds Read in the number of seconds Converts it to minutes and seconds. Test your program using PASS 10
11
Q4: Write a program to converts the input value to Hours, Minutes and Seconds Problem in Q3 60 minutes equal to 1 hour. Test your program using PASS 11
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.