You are on page 1of 1

Lab 08 – Open Ended Lab

Note: Code the following tasks during lab and prepare a detailed report. Submit the report in
next lab.

Question 1:
Consider a situation where you are working in a firm who develop sign boards using LED
interfacing with microcontroller. You are supposed to develop C++ code that will be fed into
microcontroller for further developing process.

Input:
You have to develop code that will display LED frame border. Customer will ask you for
number of LEDs in length and height. So for this reason your code must be generic, so that
the number of LEDs in length and height wise could be changed easily.

Output:
Following is the example of output frame of 20 LEDs length wise while 5 LEDs height wise:

********************
* *
* *
* *
********************

Question 2:
Write functions in C++ language for calculating the area and perimeter of a square, circle and
rectangle. Use these functions in a C++ program which takes a character input (‘s’ for square,
‘c’ for circle and ‘r’ for rectangle) from user and displays the area and perimeter of the
corresponding shape. Your program should prompt the user to enter lengths of sides based on
the specific character entered by user. Your program should have the following interface.

Enter the first letter of the shape : S


Enter the length of its sides in cms : 5
Area of this square is 25 sq.cms
Perimeter of this square is 20 cms

Question 3:
Write a C++ program which inputs 2 numbers from user and perform arithmetic operation on
it based on what user wants to calculate. For example if user enter “+” symbol the program
should add those 2 entered values. Perform this using switch-case statement.

You might also like