programming

29
Govt. Post Graduate College Samanabad Assignment # 01 Object Oriented Programming Submitted To: Mam Iqra Submitted By: Zohaib Arif Roll no.: 6823 Semester: ῙῙ Department of Information & Technology Page 1

Transcript of programming

Page 1: programming

Govt. Post Graduate College SamanabadAssignment # 01

Object Oriented Programming

Submitted To: Mam Iqra

Submitted By: Zohaib Arif

Roll no.: 6823

Semester: ῙῙ

Department of Information & Technology(evening)

Page 1

Page 2: programming

Contents .Program………………………………………………………………………………………….. Page no.

I. Display of “Word” for five times……………………………………………………………............ 3II. Display of five numbers and their sum……………………………………….……………………. 3

III. Display of counting…………………………………………………………………………….………….... 4IV. Display of numbers and their squares…………………………………………………………...… 4V. Inputting of number and display its table………………………………………..………….…… 5

VI. Distinguishing of even or odd numbers…………………………………………….………….….. 5VII. Display of digits in block pattern…………………………………….………………………….….... 6

VIII. Display of symbol as a block..………………………………………………………………………….. 6IX. Display of digits in descending order as triangle………………………………………………. 7X. Display of digits in ascending order as triangle………………….…………………………….. 7

XI. Display of more digits by changing first digit every time………………………………….. 8XII. Initializing and display of digits from array…………………………………………………....... 8

XIII. Taking of number from array and displaying………………………………………………….... 9XIV. Inputting storing in an array and displaying of numbers……………………………..…… 9XV. Inputting the numbers and then store them in an array and display the sum and

average of these numbers…………………..……………………………………………………..….. 10XVI. Input day and month and then calculates total number of days………………....…. 10

XVII. Input value and find value using linear search……………………………………………….. 11XVIII. Input value and find value using binary search………………………………………………. 11

XIX. Input five values and sorts it using bubble sort…………………………………………….… 12XX. Input five values and sorts it using selection sort…………………………………………... 12

XXI. Displays a massage using function…………………………………………………….…………… 13XXII. Input numbers in main function, passes these numbers to function and displays

maximum number………………………………………………………………………………….……… 14XXIII. Input a number in main function and passes and passes the number and function

display table……………………………………………………………………………………………….... 15XXIV. Inputs a number and displays its processor and successor numbers using

function………………………………………………….……………………………………………………. 15XXV. Create class with one integer data member and two member function……… 16

XXVI. Create class with three data member and three member function……………. 16XXVII. Create two objects of class and input value for these objects and it displays detail of

costly book………………………………………………………………………………………………….. 17

Page 2

Page 3: programming

XXVIII. Create class has num & ch data members and one constructor with on parameter and other with two parameter…………………………………………………………………………… 18

XXIX. Create class that has constructer and destructor………………………………………… 19XXX. Create member function outside the class…………………………………………………… 20

XXXI. Create member function within the class…………………………………………………… 21

Page 3

Page 4: programming

Program # 01 : To Display of “Word” for five times

Program # 02: To Display of five numbers and their sum

Page 4

Page 5: programming

Program # 03: To Display of counting

Program # 04: To Display of numbers and their squares

Page 5

Page 6: programming

Program # 05: To Input a number and display its table

Program # 06: To Distinguish of even or odd numbers

Page 6

Page 7: programming

Program # 07: To Display of digits in block pattern

Program # 08: To Display of symbol as a block

Page 7

Page 8: programming

Program # 09: To Display the digits in descending order as triangle

Program # 10: To Display the digits in ascending order as triangle

Page 8

Page 9: programming

Program # 11: To Display more digits and changing of first digit every time

Program # 12: To Initializing and display of digits from array

Page 9

Page 10: programming

Program # 13: To Take a number from an array and display

Program # 14: To Input a number and store it in an array and display by using loop

Page 10

Page 11: programming

Program # 15: To Input the numbers and then store them in an array and display the sum and average of these numbers

Program # 16: To Input day and month and then calculates total number of days

Page 11

Page 12: programming

Program # 17: To Input value and find value using linear search

Program # 18: Input value and find value using binary search

Page 12

Page 13: programming

Program # 19:To input five values and sorts it using bubble sort

Page 13

Page 14: programming

Program # 20: To input five values and sorts it using selection sort

Page 14

Page 15: programming

Program # 21: To displays a massage using function

Program # 22: To input numbers in main function, passes these numbers to function and displays maximum number

Page 15

Page 16: programming

Program # 23: To input a number in main function and passes and passes the number and function display table

Program # 24: To inputs number and displays its processor and successor number using function

Page 16

Page 17: programming

Program # 25:To declares a class with one integer data member and two member function

Page 17

Page 18: programming

Program # 26:To make a class with three data member and three member function

Program # 27: To create two objects of class and input value for these objects and it displays detail of costly book

Page 18

Page 19: programming

Program # 28:To make class has num & ch data members and one constructor with on parameter and other with two parameter

Page 19

Page 20: programming

Program # 29:To create class that has constructer and destructor

Page 20

Page 21: programming

Program # 30:To create member function outside the class

Page 21

Page 22: programming

Program # 31:To create member function within the class

Page 22

Page 23: programming

Page 23

Page 24: programming

Page 24