15. Create two classes MC and FI which stores values of distances. MC stores distance in meter and cm and FI stores in feet and inches. Write a program that reads and output the values of object of each class and use a friend function to carry out the addition of two distances and produce the result in FI type.
Wednesday, May 19, 2010
Subscribe to:
Post Comments (Atom)
hu mahek chu
ReplyDeleteLavde kya chutiya website banai hai, kitna chota dikh Raha hai ye program.
ReplyDeleteTere baap ne itna chota hai kya?
DeleteNahi Dena hai program thik se toh thik hai na bhai par ye kya bakchodi hai?
ReplyDeleteBc lavda mc Kya ha ye
ReplyDeleteek ek line read kru kya
ReplyDelete8 saal ho gayay is chutiya bakchodi ko
ReplyDelete#include
ReplyDelete#include
class fi;
class mc
{
int m,cm;
public:
mc()
{
m=0;
cm=0;
}
void getdata()
{
cout<<"\nEnter the length in meter and centimeter ";
cin>>m>>cm;
}
friend fi add(fi,mc);
};
class fi
{
int f,i;
public:
void getdata()
{
cout<<"\nEnter the length in feet and inch ";
cin>>f>>i;
}
void putdata()
{
cout<<f<<" feet"<<i<<" inch";
}
friend fi add(fi,mc);
};
fi add(fi f1,mc m1)
{
fi t;
float j;
j=m1.m*100+m1.cm;
j=j*0.393700787;
t.f=j/12;
int k=int(j);
t.i=k%12;
t.i=t.i+f1.i;
t.f=(t.i/12)+t.f+f1.f;
t.i=t.i%12;
return(t);
}
void main()
{
clrscr();
mc m1;
fi f1,f2;
m1.getdata();
f1.getdata();
f2=add(f1,m1);
cout<<"\n Sum length ";
f2.putdata();
getch();
}
Pura program khush raho bhai log
Delete