1. 1 | P a g e
CS-212 Object Oriented Programming
National University of Sciences and Technology
School of Electrical Engineering and Computer Science
CS-212 Object Oriented Programming
LAB No. 01
Section: BEE 12-C
Submitted to: Ms. Shakeela Bibi
Instructor: Dr. Khuram Shahzad
Name CMS ID
Ahamed Musharaf 356481
2. 2 | P a g e
CS-212 Object Oriented Programming
LAB TASKS
Activity:
Run the following program and attach screenshot of output.
Code:
Output:
3. 3 | P a g e
CS-212 Object Oriented Programming
Code:
4. 4 | P a g e
CS-212 Object Oriented Programming
Output:
Activity:
Write a complete C++ program that produces the following output.
/
//
///
///
//
/
Code:
Output:
5. 5 | P a g e
CS-212 Object Oriented Programming
Task 1:
Write a C++ program to print the area and perimeter of a circle.
Code:
Output:
6. 6 | P a g e
CS-212 Object Oriented Programming
Task 2:
Write down a simple program that takes the length in Feets and inches and then converts it
into centimeters.
Based on the problem, you need to design an algorithm as follows:
1. Get the length in feet and inches.
2. Convert the length into total inches.
3. Convert total inches into centimeters.
4. Output centimeters.
Hint: One Feet is 12 inches. One inch is 2.54 cm.
Code:
7. 7 | P a g e
CS-212 Object Oriented Programming
Output:
Task 3:
Write down a simple program which can convert a String into all Upper Case? (Please don’t
use the build in function and reinvent the wheel.)
Hint: The ASCII Value of Upper-Case A is 65 and Lower Case a is 97.
Hint: difference in ASCII codes of the lowercase and uppercase counterparts of a character is 32
Code:
8. 8 | P a g e
CS-212 Object Oriented Programming
Output:
Task 4:
Write a Program that can take five real numbers and then able to sort them and display
them in the Descending Order.
Code:
9. 9 | P a g e
CS-212 Object Oriented Programming
Output: