You are on page 1of 3

Lab Report Two

1. You have to hand in a Lab report, all source code, and snapshots
of program output or results before the deadline. If you miss the
deadline, just get half mark for this assignment.
2. If anybody copies any code from another student, both of them get
0 mark.
3. Please submit your code (*.cpp) and report(*.doc, *.docx or *.pdf)
to chaoxing system.
4. Lab Target
(1) To be familiar with the Programming software
(2) To get basic programming skills: Input, Output, Arithmetic operators.
5. Tools
Operation System: : Not limited
Programming Language: C++ Programming Language
Textbook: Starting Out with C++ Early Objects

6. Tasks (After finish the following tasks, hand in Lab Reports, all source code,
and snapshot of running results)
Note: Operators of Addition(+), subtraction(-), multiplication(*), division(/)
6.1 Task One
Type the example code on Page 40, compile, run it and capture its output.()

Result
6.2 Task Two
Write a C++ program that accepts (cin) two item’s weight (floating points
values ) and number of items (interger values) and calculate the average weight
of the items. Display the messages on the window.
Test Data : (Students should use different data in a program)
Weight - Item1: 15.9
Number of item1: 5

Weight - Item2: 25.8


Number of item2: 8

Expected Output:
Average Weight = **********(real result in the right format)

Result

6.3 Task Three


Write a C++ program to convert specified days(sin) into years, weeks and days.
Display the messages on the window.(cout)
Note: Ignore leap year. 365 days per year.
Use operators, such as : + - * / %
Test Data : (Students should use different data in a program)
Number of days : 1329
Expected Output :
Years: 3
Weeks: 33
Days: 3

Result

You might also like