hi friends,
check this program beneath.......
\\program to fin integere part and fractional part of given real number...
#include<iostream.h>
#include<conio.h>
void intfrac(int,float&,float&);
void main()
{
float number,intpart,fracpart;
cout<<"enter any real number:";
cin>>number;
intfrac(number,intpart,fracpart);
cout<<"integer part is:"<<intpart;
cout<<"\nfraction part is:"<<fracpart;
getch();
}
void intfrac(float n,float& intp,float& fracp)
{
fracp=n%1;
intp=n-fracp;
}
i was doing this program in order to implement the concept of passing the
value by reference in functions.
this can be done easily by using type casting,bt i was trying this logic......
but compiler is showing some errors (fracp=n%1;)in this line.
can someone help me with it........plz
also if someone can give some good points about the diff. between pass by reference
and pass by value......