free geoip

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CS201 assignment #5
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#10
/* ID: MC100402622.
Name: M.MOHSIN CH.
*/


#include <iostream.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <fstream.h>
using namespace std;


class crectangle
{
private:
int itop;
int iright;
int ibot;
int ileft;

public:

static int irefcount;
// default constructor is declared below.
crectangle ();
// copy constructor is declared below.
crectangle (crectangle &, crectangle *);
// destructor is declared below.
~crectangle ();

// methods are declared below.
int getrectanglearea (crectangle &);
void getitop();
void getiright();
void getibot();
void getileft();
void getirefcount();
void setmembrs (int,int,int,int);
void setitop(int);
void setiright(int);
void setibot(int);
void setileft(int);

};

// Methods, constructor and destructor are defined below.

// crectangle () is defined below.
crectangle::crectangle ()
{
itop=0;
iright=0;
ibot=0;
ileft=0;
irefcount++;
}// crectangle ()'s defination ends here.

// crectangle (crectangle &) is defined below.
crectangle::crectangle(crectangle &a, crectangle *pointer)
{
pointer=new crectangle;
pointer->itop=a.itop;
pointer->iright=a.iright;
pointer->ibot=a.ibot;
pointer->ileft=a.ileft;
irefcount++;
}

// destructor ~crectangle () is defined below.
crectangle::~crectangle()
{
irefcount--;
}// ~crectangle ()'s defination ends here.

// getitop () is defined below.
void crectangle:: getitop()
{
cout<<endl<<"Value of ITop is: \t"<<itop<<endl;
}// getitop ()'s defination ends here.

// getiright() is defined here.
void crectangle:: getiright()
{
cout<<endl<<"Value of IRight is: \t"<<iright<<endl;
}// getiright()'s defination ends here.

// getibot () is defined below.
void crectangle:: getibot()
{
cout<<endl<<"Value of IBot is: \t"<<ibot<<endl;
}// getibot ()'s defination ends here.

// getileft () is defined below.
void crectangle:: getileft()
{
cout<<endl<<"Value of ILeft is: \t"<<ileft<<endl;
}// getileft ()'s defination ends here.

// getirefcount () is defined here.
void crectangle:: getirefcount()
{
cout<<endl<<"Value of IREfcount is: \t"<<irefcount<<endl;
}// getirefcount()'s defination ends here.

// getrectangleare () is defined below.
int crectangle::getrectanglearea(crectangle &a)
{
return (a.itop * a.iright * a.ibot * a.ileft);

}// getrectanglearea ()'s defination ends here.

// setmembers (int, int ,int ,int ) is defined below.
void crectangle:: setmembrs(int a, int b, int c, int d)
{
itop=a;
iright=b;
ibot=c;
ileft=d;
} // setmembers ()'s defination ends here.


// setitop (int) is defined below.
void crectangle:Confusedetitop(int a)
{
itop=a;
}//setitop (int) ends here.

// setiright (int) ends here.
void crectangle:: setiright (int b)
{
iright=b;
}// setiright (int)'s defination ends here.

// setibot(int) is defined below.
void crectangle:Confusedetibot(int c)
{
ibot=c;
}//setbot (int)'s defination ends here.

// setileft(int) is defined below.
void crectangle:Confusedetileft(int d)
{
ileft=d;
}// setileft(int)'s defination ends here.



// Static member of class is intialized here.
int crectangle::irefcount=0;

// Main () function starts from here.
main ()
{
int a, b, c, d =0;
crectangle *pointer;
crectangle rectangle1, rectangle2;
a=6;
b=13;
c=14;
d=5;
cout<<endl;
rectangle1.setitop(a);
rectangle1.setiright(b);
rectangle1.setibot©;
rectangle1.setileft(d);
cout<<"Area of rectangle1 is: \t"<<rectangle1.getrectanglearea(rectangle1)<<endl;
a=3;
b=10;
c=8;
d=20;
rectangle2.setmembrs(a,b,c,d);
cout<<endl<<"Area of rectangle2 is: \t"<<rectangle1.getrectanglearea(rectangle2)<<endl;
cout<<endl<<"The Number of Rectangles is \t"<<crectangle::irefcount<<endl;
crectangle(rectangle1,pointer);
cout<<endl<<"After using copy-constructor Number of Rectangles is \t"<<crectangle::irefcount<<endl;
delete pointer;
cout<<endl<<"The Number of Rectangles is \t"<<crectangle::irefcount<<endl;

}
Reply


Messages In This Thread
CS201 assignment #5 - by usman malik - 07-11-2010, 07:16 AM
CS201 assignment #5 - by viki - 07-12-2010, 01:57 PM
CS201 assignment #5 - by usman malik - 07-13-2010, 06:29 AM
CS201 assignment #5 - by digger303 - 07-15-2010, 05:22 PM
CS201 assignment #5 - by sanam - 07-15-2010, 05:24 PM
CS201 assignment #5 - by M.Ali - 01-31-2011, 11:38 PM
CS201 assignment #5 - by Xpert - 02-01-2011, 02:35 AM
CS201 assignment #5 - by techaholic - 02-01-2011, 02:48 AM
CS201 assignment #5 - by Xpert - 02-02-2011, 01:10 AM
CS201 assignment #5 - by mohsin33 - 02-02-2011, 05:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need ACC501 - Business Finance Assignment No 2 Solution. Umar Abbas 2 4,263 02-07-2014, 08:23 PM
Last Post: Umar Abbas
  sta301 assignment 4 27 jun bc110200090 6 3,605 01-26-2013, 02:05 AM
Last Post: Vuhelper
  cs506 2nd assignment millee 0 2,678 12-04-2012, 11:30 PM
Last Post: millee
  cs506 2nd Assignment Neelam Ahmad 5 3,155 12-04-2012, 11:24 PM
Last Post: Vuhelper
  CS 504 Assignment 2 need help ommmi 24 11,480 11-27-2012, 04:59 AM
Last Post: Xpert
  Urgent need Cs201 first assignmt solution r_traveler 4 2,284 11-07-2012, 01:47 AM
Last Post: Xpert
  Mcs cs402 1st assignment chahat4all 2 3,787 11-01-2012, 11:11 PM
Last Post: chahat4all
  eng201 assignment 4 due date 4/7/2012 bc110200090 6 2,631 07-03-2012, 03:51 PM
Last Post: bc110200090
  need CS304 4th assignment shazma 0 2,074 06-26-2012, 12:48 PM
Last Post: shazma
  sta301 assignment 4 solution vudecent 0 2,417 06-25-2012, 01:51 AM
Last Post: vudecent

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support