Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
9 views

CPP Assignment

Fill in your advertisement on the post of the post

Uploaded by

sutarashu45
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

CPP Assignment

Fill in your advertisement on the post of the post

Uploaded by

sutarashu45
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

DiSHA COMPUTER INSTITUTE, (Islampur)

Programming Assignment

C++Programming
Assignment – 1
TOPIC COVERED: Function in c ++

1. Write a program to find the factorial of a number using function.


2. Write a program to calculate area of circle and circle and circumference.
3. Write a program to find the circumference of circle by passing default
argument as pie to the function.
4. Write a program to convert for to upper case by creating function name
lowercase0.
5. Write a program to find out whether number is prime or not using
function.
6. Write a program to create a function that will calculate the
multiplication table of number entered to it.
7. Write a program to find whether the string is palindrome or not.
8. Write a program to create a structure having the following of employee
EmpID & Ename[10]

Address:-

Disha computer institute, DiSHA


COMPUTER INSTITUTE
Near mankeshware theater, An ISO 9001 : 2000 Certified
nd
Drushti hospital, 2 floor,

Peth-Sangli road,Islampur.

Contact:- 8652844445

8693844446
DiSHA COMPUTER INSTITUTE, (Islampur)

Assignment –2
TOPIC COVERED: Classes and Object.
1. Create a class named item having two functions putdata() .getdata()will
accept values in class variables no& cost and putdata () will put the
values.
2. Create a class having three member function getdata() will accept values
in member variable.
3. Largest () which is going to retrieve largest integer and display () which
will display the largest to integers.
4. Create a friend function fact() that will accept object as parameter and
calculate factorial of number.
5. Create a function swap in a class which will swap two members entered.
6. Define a class to represent a bank account include the following
functions
 Data members
 Name of depositor
 Account number
 Type of account
 Balance amount in the account.
 Function
 To assign initial values
 To deposit
 To withdraw an amount after checking balance.
 To display name and balance.

DiSHA
COMPUTER INSTITUTE
An ISO 9001 : 2000 Certified
DiSHA COMPUTER INSTITUTE, (Islampur)

Assignment –3
TOPIC COVERED: Constructor & Destructor
1. Write a program to find Fibonacci series of the number entered by the
user. Initialize the value in the parameterized constructor.
2. Write a program to find the function of a given using constructor.
3. Write a program to accept the value of the name of an employee & its
salary using a constructor and print the value of the using display ().
4. Write a program to accept two numbers in the constructor of the class
and create functions sum(),diff(), mul(),div(), which will calculate sum,
difference, product & quotient of number.
5. Write a program to implement overloaded constructor with the name
x,x must be empty constructer and x and must be a parameterized
constructor & it must also be a copy constructor.
6. Write a program to create a class fib with overloaded that will initialize
the value of n i.e. number until which we need to find Fibonacci series.
7. Write a program to accept the name, rollno & makes of a student in
constructor & calculate its average in the function avg() and print the
message whether the student has passed or failed the criteria for
student to pass or fail is avg>35 pass avg<35 fail

Address:-

Disha computer institute,


Near mankeshware theater, DiSHA
Drushti hospital, 2nd floor, COMPUTER INSTITUTE
An ISO 9001 : 2000 Certified
Peth-Sangli road,Islampur.
Contact:- 8652844445
8693844446
DiSHA COMPUTER INSTITUTE, (Islampur)

Assignment –4
DiSHA
COMPUTER INSTITUTE
TOPIC COVERED: Inheritance An ISO 9001 : 2000 Certified

1. Create a class Base initializing two variables a & be in its constructors.


Another class Derived has a function multiply () which will multiply to
numbers form base class& display the result in the main ()

2. Create a class student that will have protected variable getnumber (int).
this function will accept the roll number of student. Create another class
test that will publically inherit student class. This class contains marks in
getmarks () function. Finally there is another class result which display
the total by calculating it & printing. The display function should also
print the roll number accepted in student class. The result class will
inherit the class the class test publicly.

Student

Test

Result

3. Create a class Bank Ac that accepts accounts number, account type,


balance. Create two classes Deposits & withdraw that will inherit bank
publicly. In class Deposit, there is a function that which will deposit that
amount. In a class withdrawal, there is a function that allow withdrawing
but the minimum balance should be at least rs. 500 check for the
criteria. In the main accept the choice the form user by allowing him to
enter D for deposit & W for withdrawal. Depending on choice,
respective function must be called.

Bank

Deposit Withdrawal
DiSHA COMPUTER INSTITUTE, (Islampur)

4. An aducation institute stores the database of employees. That program


will contain the number of classes whose hierarchical relationship is shown
below. The figure also shows the minimum information required for each
class. Specify all the classes & define function to create the database &
retrieve information when required. Create the required functions no fetch
& print the data.

Staff

Code, Name

Teacher Typist Deposit


Subject Speed Grade

Address:-

Disha computer institute,

Near mankeshware theater,

Drushti hospital, 2nd floor,


DiSHA
Peth-Sangli road,Islampur. COMPUTER INSTITUTE
An ISO 9001 : 2000 Certified

Contact:- 8652844445

8693844446
DiSHA COMPUTER INSTITUTE, (Islampur)

Assignment –5
TOPIC COVERED: Polymorphism
1. Write a program to swap (2,3) (4,5) numbers using function overloading.
Give the name of the function as swap.
2. Create the overloaded function sum, one is having two int parameters &
one is having five int parameters.
3. Create a base class shape. Use this class to store to double types values
that could be used to compute the area of figures. There are two specific
classes called triangle & rectangle which are derived form base class shap.
Base class contains one member function display_area()as a virtual
function & redefine this function in deriveclasses to suite their
requirement.
4. Create a class space having three variables x,y,&,z. the class has two
functions getdata () having three int parameters & display () which display
the variables. It also contains overloaded unary operator-() that will covert
the member form negative to positive as required.
5. Create a program using overloading that will and, subtract, multiply &
divide the complete numbers ( using binary overloading )
6. Create a class to implement binary operator +, that will concatenate two
strings when involved.
7. Consider a book shop which sells bolt books & videotapes .Create a class
known as media that stores title & price of book. A display () is used in all
the classes to display the class content. Implement the program using
virtual pointer. initialize the values in the sub class & base class using base
class using base constructor.

DiSHA
COMPUTER INSTITUTE
An ISO 9001 : 2000 Certified
DiSHA COMPUTER INSTITUTE, (Islampur)

Assignment -6
Topic covered: file handling
1. Write a program that will print all the even numbers & odd numbers
between the range of 1 to 20 different files.

2. Write a program that will the data form one file.

3. Write a program to create a class having function Fibonacci that will


accept the number form user & generate the result in the file .

4. Write a program that will read data form the file & print it on the user
screen.

Address:-
DiSHA
Disha computer institute, COMPUTER INSTITUTE
An ISO 9001 : 2000 Certified
Near mankeshware theater,

Drushti hospital, 2nd floor,

Peth-Sangli road,Islampur.

Contact:- 8652844445,8693844446

You might also like