Why Is My Function Returning 0?

The program simply multiplies us_dollars * rate, and always gives me zero no matter what!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
private: void ReadData(double readUs_Dollars, double readRate)
			 {
				 Double::TryParse(txtUSD->Text, readUs_Dollars);
				 Double::TryParse(txtRate->Text, readRate);
			 }

private: double ConvertIt(double calcUs_Dollars, double calcRate)
			 {
				 double calcNew_Money = calcUs_Dollars * calcRate;
				 return calcNew_Money;
			 }

private: System::Void btnConvert_Click(System::Object^  sender, System::EventArgs^  e)
			 {
				 double us_dollars, rate, new_money;
				 ReadData(us_dollars, rate);
				 new_money = ConvertIt(us_dollars, rate);
				 txtNew->Text = new_money.ToString();
			 }
};
}
Does anyone know?? I feel like it's a real simple answer, but I just can't figure it out!
Seriously someone PLEASE help!!!!!!!!!!!!
For starters that's not even standard c++ looks like c++/cli or c++/clr.

I feel like the read function should pass the parameters as reference. with the & sign.

Try

private: void ReadData(double &readUs_Dollars, double &readRate)





Oh and by the way...This is a FORUM not a CHAT so don't expect instant replies.
Last edited on
Topic archived. No new replies allowed.