@vladpenziy13

Почему не присваиваются значения с++?

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);

В мэйн не доходят значения которые я прописал.
  • Вопрос задан
  • 139 просмотров
Решения вопроса 1
gbg
@gbg Куратор тега C++
Любые ответы на любые вопросы
Потому что вы передаете по значению (это означает, что функция получит копию аргумента), а надо передавать по ссылке:
int input(TComplex& a, TComplex& b, TVect& first, TVect& second, float& one )
{
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы