www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

# CS201 Assignment # 4 ; Due date 28 Jan 2013

Views: 3822

Attachments:

### Replies to This Discussion

Solution:

#include <iostream.h>

class Location
{
int l1;
int l2;

public:
Location();
Location(int lon,int lat);
void view();
Location operator ++();
Location operator --();
void* operator new (size_t size);
void operator delete( void * ptr );
};

Location::Location()
{
l1=0;
l2=0;
}

Location::Location(int lon,int lat)
{
l1=lon;
l2=lat;
}
void Location::view()
{
coutendl"Longitude : "l1endl;
cout"Latitude : "l2endlendl;
}
void* Location::operator new(size_t size)
{
void * rtn = malloc (size ) ;
return rtn;
}
Location Location::operator ++()
{
++l1;
++l2;
}
Location Location::operator --()
{
--l1;
--l2;
}
void Location :: operator delete( void *memory )
{
free( memory );
}

main()
{

system("cls");
Location l1(10,20), *l2= new Location(30,40);

coutendl"Coordinates for Location 1:";
l1.view();
++l1;
cout"After applying overloaded ++ operator on Location 1 : ";
l1.view();
cout"Coordinates for Location 2:";
l2[0].view();
--l2[0];
cout"After applying overloaded -- operator on Location 2 : ";
l2[0].view();
delete l2;
system("pause");
}

ye to compile hi nhi ho rhi is me to err hai jnab

ye compile hona b nahi hai.. q k ye relevent asnwer hai he nahi..

itx nt my solution

teel the correct program

ye solution C++ mai kis tara likaingai

ye file c++ mai kis tara hoga convert ka tarika batai

Suspense ended!

Enjoy!

Attachments:

thnks koi error nehi is main

thanks

error hain is main b

1

2

3

4

5

## VIP Member Badge & Others

------------------------------------

## Latest Activity

1 minute ago
Laila kabeer posted discussions
2 minutes ago
5 minutes ago
13 minutes ago
1 hour ago
+ ! ! !★ "Areena"★✓ and Anu Shay are now friends
1 hour ago
ልጠክል ጌዘልፕፕጎ liked + ♥ Haniya khan's discussion (Bal-e-Jibril)
1 hour ago
Z@¥¥@N R@JPuT posted a discussion

1 hour ago