How To Exam?

a knowledge trading engine...


Lovely Professional University 2008 B.Tech Information Technology Assignment 2 - C++(Object Oriented Programming) - Question Paper

Friday, 25 January 2013 04:00Web


ASSIGNMENT II

CSE 202, Object Oriented Programming
Static Members And Static Functions,Const,Friend Function


1. Can a class have static data members as well as static functions in a identical program? discuss how?

2. How can we declare static member function of a class.Explain with example.

3. Mention 3 Characteristics of a static data members.

4. Find out errors

a)
# include
class abc
{
private:
static int count;
public:
abc()
{
count=10;
}
void display() const
{
cout<}
};

void main()
{
abc a1,a2,a3;
a1.display();
a2.display();
a3.display();
}


b) # include
class example
{
private:
int data;
public:
example();
void display()const;
};
example::example()
{
data=0;
}
example::display()
{
cout<}

void main()
{
example d;
d.display();
}


c) # include
class ss
{
static int c;
public:
static void set()
{
c++;
}
void display()
{
cout<< c;
}
};
int ss::c=12;

void main()
{
s obj;
obj.set(3);
ss:set();
obj.display();
}


d)#include
class item
{
private:
static int count;
public:
item()
{
count++;
}
int getcount()
{
return count;
}

int* getcountaddress()
{
return count;
}
};
int item::count=0;

void main()
{
item obj1;
item obj2;

cout<< obj1.getcount()<<’ ‘ ;
cout<< obj2.getcount()<< ‘ ‘;
}


5)WAP that describes a class complex (defining a complex number).Write a friend function that take 2 argument of class complex and returns a complex number?


6)Explain the features of i/o system supported by C++?Write role of iomanip.h header file play?


7.) Write output
For(i=0.25;i<=1.0;i+0.25)
{
cout.precision(5);
cout.width(7);
cout< cout.width(10);
cout<}
cout<cout<

8. Write in detail with examples
a) Ios Class functions
b) Inbuilt manipulators
c) User described Manipulators



( 0 Votes )

Add comment


Security code
Refresh

Earning:   Approval pending.
You are here: PAPER Lovely Professional University 2008 B.Tech Information Technology Assignment 2 - C++(Object Oriented Programming) - Question Paper