Labsheet
Labsheet
LAB 2 Week 3
LAB 2 WEEK 3
Objective
1. To become familiar with compiler
2. To compile and run your first C++ program.
3. To recognize syntax and logic errors.
4. To design algorithms using flowchart and pseudocode.
Deliverables:
Simple C++ programs.
Flowchart and pseudocode.
Save the file to disk as hello.cpp. Compile and run the program.
NOTE: If you have the problem with the MSDOS display, Add
system("pause"); before return(0); to pause the output display.
C. Write three versions of the hello.cpp program that have different syntax
errors. Explain each error.
1 Sep 2012
Fundamental Programming
LAB 2 Week 3
Activity #2
A program is required to read from screen the length and width of a rectangular
house block and the length and width of the rectangular house that has been built on
the block. The program should then compute and display the mowing time required
to cut the grass around the house at the rate of two square meters per minute.
Activity #3
Design a program for this company that will read the customer usage file, calculate
the amount owing for electricity usage for each customer and print a report listing
each customer’s id, name/owner, address, their electricity usage and the amount
owing. At the end of the report, print the total number of customers and the total
amount owing to the company. Use flowchart to design your proposed algorithm.
References:
Labsheet materials of Structured Programming & Database lab. class,
Computer & Information Sciences Department., University Technology Petronas.
2 Sep 2012