Professional Documents
Culture Documents
1 / 17
MICROCOMPUTER LABORATORY
(MAKMAL MIKROKOMPUTER)
2. INTRODUCTION / THEORY
CONTROL STRUCTURES:
Selection
Flowchart syntax
structures
if
if/else
Nested
if/else
statement
Faculty of Engineering Technology Page No. 4 / 17
switch
statement
while
do/while
for
Faculty of Engineering Technology Page No. 5 / 17
3. EQUIPMENT / REQUIREMENT
4 PROCEDURES (TASKS)
#include <iostream>
using namespace std;
main ()
{
int x;
cout <<"\n Please enter number '5'\n";
cout <<"\n ";
cin >>x;
if(x == 5)
{
cout << "\n you enter no ="<<x<<endl;
cout << " yes, that is the number!!\n"<<endl;
}
cout << "\n See you again"<<endl;
return 0;
}
#include <iostream>
using namespace std;
main ()
{
int x;
cout <<"\n Please enter number '5'\n";
cout <<"\n ";
cin >>x;
if(x == 5)
{
cout << "\n you enter no ="<<x<<endl;
cout << " yes, that is the number!!\n"<<endl;
}
else
{
cout << "\n you enter no ="<<x<<endl;
cout << "\n wrong, that not the number!!\n"<<endl;
}
return 0;
}
4.2.3 What the different between program 4.1 and 4.2. [2 marks]
#include <iostream>
using namespace std;
int main()
{
int number;
cout<<" Enter a number between 0 and 30"<<endl;
cout<<"\n ";
cin>>number;
cout<<"\n";
4.4 Given table 1 is UTHM student score versus grade. Please create flowchart and C++ code that
will read the student score, grade it and then display Operators [16 marks]
#include <iostream>
using namespace std;
main ()
{
float x, y, min;
cout << " Enter two different integer numbers:\n";
cout << "\n 1st integer number x: ";
cin>>x;
cout << "\n 2nd integer number y: ";
cin>>y;
return 0;
}
4.6 Create C++ programming base on output Figure 4.6.1 & 4.6.2 [8 marks]
4.7 Create flowchart and C++ programming using if/else selection [28 marks]
Ahmad and Harun want to buy some food from Warung Pak Tam. Since Ahmad is the cousin of
Pak Tam, he will get 20% discount but Harun still remain to normal price. But if the total price
over than Rm100.00, the buyer will get 30% discount. From menu table 4.7.1 and 4.7.2:
4.7.1 Calculate the exacly price that Ahmad and Harun need to pay. [8 marks]
Faculty of Engineering Technology Page No. 15 / 17
5. DISCUSSION
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
___________________________________________________________________ (10 marks)
6. CONCLUSION
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
____________________________________________________________________ (10 marks)