You are on page 1of 2

TCB2073 Structured Programming & Database Week 4

LAB 1 WEEK 4

Activity #1 Label all elements in the C++ program below.

//student ID : //Student Name:

"

#include <iostream.h> #define KMS_TO_MI !S ".#$% int main &' ( dou)le *ms+ dou)le mile+ 8 // -et the distance in miles cout << .!nter the distance in *ilometers : . + cin >> mile+ # // con/ert the distance *ms 0 KMS_TO_MI !S , mile+ //dis1la2 the distance in miles cout << .That is e3ui/alent to : . << *ms << . miles.. << endl+ return &$'+ 4 9 7 /,distance in *ilometers ,/ /,distance in miles ,/ 6

TCB2073 Structured Programming & Database Week 4

Activity #2 Write a program for a computer shop which calculates daily transaction !he computer shop sells monitor" #ey$oard" mouse and headphone !he price of a monitor is %4&" price of mouse is %'" price of #ey$oard is %' and price of headphone is %( )ote* student as# from user that how many items he+she want to purchase of each items ,ate (+2+14 (+2+14 (+2+14 (+2+14 -tem /onitor #ey$oard /ouse 1eadphone .uantity 2 ( 2 1 !otal price %0& %1' %1& %( %1&0

You might also like