#include<iostream>
using namespace std;
struct complex
{
int real;
int imag;
};
int display(complex);
int read (complex);
int main()
{
complex l;
read(l);
display(l);
}
int read(complex l)
{
cout<<"enter the real part : ";
cin>>l.real;cout<<endl;
cout<<"enter the imag part : ";
cin>>l.imag;cout<<endl;
}
int display(complex l)
{
cout<<"real part is : "<<l.real<<endl;
cout<<"imag part is : "<<l.imag<<endl;
}
uhm, you might want to actually read in the complex var, but you make a call-by-value so when passing the complex var, you make a copy and so the Value that you read in is only changed in the copy of the complex var.
try passing it as reference, then the passed object gets modified int read(complex& l)
Also, your methods are declared as "int" but they don't return anything, you might want to change your function declerations to void
Usually you just copy the error message in here ^^
Note: please use the <> Symbol on the right of the text field under "Format" to display code, it is much easier to read