-2
 void conver(double&, int&);
 private: System::Void cb1_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {

         a=1;
         if ((a==1)&&(b2==1))
         {if(cb1->Text=="Celsius")
             {
                 input=System::Convert::ToDouble(cel->Text);
                 if (cb2->Text=="Celsius")
                 {
                     choice=1;
                     conver(input,choice);
                 } 
                 if(cb2->Text=="Fahrenheit")    
             }   
         }
     }

I am getting the following error:

Error: function "Project3::MyForm::conver" cannot be called with the given argument list. argument types are: (double, int)

Image

I don't understand what this means. Can't we pass arguments by reference in Visual C++?

Max Leske
  • 5,007
  • 6
  • 42
  • 54

3 Answers3

0

You are passing an actual number - not a variable - by reference. You cannot pass in numbers by reference because numbers do not have addresses assigned in the registry (memory). You will have to use a variable.

You can do for example:

int myFirstNumber = 1;
int mySecondNumber = 1;

conver(myFirstNumber, mySecondNumber);
Jossie Calderon
  • 1,393
  • 12
  • 21
  • @Amar30657: Have you tried this solution? How did it work for you? – Jossie Calderon Jun 11 '16 at 05:55
  • i wasnt seeking lik that itll probably work i guess but can u review my code again –  Jun 11 '16 at 05:57
  • 1
    @Amar30657, please create a new question for a different issue in the future. This drives the answerer to give much effort with no visible result. If the first answer helped you, please click the up-arrow to this answer. – Jossie Calderon Jun 11 '16 at 05:58
  • u help i click if it was that so then why did stack ovrflow give edit option man come on help –  Jun 11 '16 at 06:00
  • 1
    @Amar30657: editing is for revising and **improving** posts. – Jossie Calderon Jun 11 '16 at 06:02
0

If I am not wrong

conver(int&, int&);  

needs integer reference variable

conver(1,1);  

and you are passing constants

Try passing int variables

Priyesh Kumar
  • 2,837
  • 1
  • 15
  • 29
0

conver(1,1);

You're passing numbers instead of variables.

merelyMark
  • 367
  • 3
  • 9