programming

Post on 18-Jan-2017

100 views 1 download

Transcript of 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

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

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

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

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

Page 4

Program # 03: To Display of counting

Program # 04: To Display of numbers and their squares

Page 5

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

Program # 06: To Distinguish of even or odd numbers

Page 6

Program # 07: To Display of digits in block pattern

Program # 08: To Display of symbol as a block

Page 7

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

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

Page 8

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

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

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

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

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

Page 12

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

Page 13

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

Page 14

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

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

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

Page 17

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

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

Page 19

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

Page 20

Program # 30:To create member function outside the class

Page 21

Program # 31:To create member function within the class

Page 22

Page 23

Page 24