Answer the question
In order to leave comments, you need to log in
Why aren't c++ values assigned?
int input(TComplex a, TComplex b, TVect first, TVect second, float one )
{
cout << "First complex.Enter real number:";
cin >> &a->re;
cout << "Enter imaginary number:" << endl;
cin >> &a.im;
cout <<"Second complex.Enter real number: ";
cin >> &b.re;
cout << "Enter imaginary number: ";
cin >>&b.im;
cout << "First coordinate. X:";
cin >> &first.x;
cout << "Y:";
cin >> &first.y;
cout << "Second coorditane. X:";
cin >> &second.x;
cout << "Y:";
cin >> &second.y;
cout << "Enter a float nubmer";
cin >> &one;
cout << double(a.re)<< double(a.im) << double(b.re)<<double(b.im) << float(one) << int(first.x) << int(second.x)<< endl;
}
int main(void)
{
TComplex a,b;
TVect first,second;
float one;
input(a,b,first,second,one);
function(a,b);
cout << double(a.re)<< double(a.im) << double(b.re)<<double(b.im) << float(one) << int(first.x) << int(second.x);
Answer the question
In order to leave comments, you need to log in
Because you are passing by value (which means the function will get a copy of the argument), but you have to pass by reference:
int input(TComplex& a, TComplex& b, TVect& first, TVect& second, float& one )
{
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question