OPOVLFRD - { t.m=t.m-(1000*t.km); } return t; } int dist ::...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<iostream.h> #include<conio.h> # class dist { int km,m; public: void get() { cin>>km>>m; m=m+km*1000; } void display() { cout<<endl<<km<<" "<<m; } friend dist operator-(dist,dist); int operator>(dist); }; } dist operator-(dist d1,dist d2) { dist t; t.m=d1.m-d2.m; t.km=t.m/1000; if(t.m>1000)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { t.m=t.m-(1000*t.km); } return t; } int dist :: operator>(dist d) { if(m>d.m) return 1; else return 0; } void main() { clrscr(); dist s11,s22,s33; s11.get(); s22.get(); if(s11>s22) s33=s11-s22; else s33=s22-s11; s33.display(); getch(); }...
View Full Document

This note was uploaded on 10/25/2010 for the course CMPN SEM1 taught by Professor Thakur during the Fall '06 term at University of Mumbai.

Ask a homework question - tutors are online