well,i use visual c++.NET 2003.i am organizing a windows form application.i attached a form shape to tell my problem.according to that form,say if u select radiobutton1,it will make cruise calculations whereas if u select radio button 2,it will make descend calculations. but at the end it will give a profile output.so i neeed to use one output of a calculation as an input to the others.the experienced users now may imagine the problem .inside the code:
private: System::Void button1_Click(System::Object * sender, System::EventArgs * e)
{
//altitude variable that must be updated by the following cases.
double & altitude;
if (radioButton1->Checked==true)
{
// CLIMB calculations
// finds altitude here and must update the altitude value!!!!
altitude=altitude+climbaltitude;
}
if (radioButton2->Checked==true)
{
// DESCEND calculation
// finds altitude here and must update the altitude value!!!!
altitude=altitude-descendaltitude;
}
but the problem is :
d:\c++\samples\lbox\list\Form1.h(311): error C2530: 'altitude' : references must be initialized
please the experienced users,help me.HOW CAN I INITIALIZE THAT REFERENCE "altitude"? i dont find it,if u know please tell me.
or u can also help me in another way;
imagine the same code but i define altitude just before the button click ,like;
.
.
double& altitude;
private: System::Void button1_Click(System::Object * sender, System::EventArgs * e)
{
.
.
and in this case it has an error as:
d:\c++\samples\lbox\list\Form1.h(25): error C2758: 'list::Form1::altitude' : must be initialized in constructor base/member initializer list
HOW CAN I INITIALIZE THAT REFERENCE IN CONSTRUCTOR BASE/MEMBER INITIALIZER LIST?
THANK U FOR YOUR CONSIDERATION.
private: System::Void button1_Click(System::Object * sender, System::EventArgs * e)
{
//altitude variable that must be updated by the following cases.
double & altitude;
if (radioButton1->Checked==true)
{
// CLIMB calculations
// finds altitude here and must update the altitude value!!!!
altitude=altitude+climbaltitude;
}
if (radioButton2->Checked==true)
{
// DESCEND calculation
// finds altitude here and must update the altitude value!!!!
altitude=altitude-descendaltitude;
}
but the problem is :
d:\c++\samples\lbox\list\Form1.h(311): error C2530: 'altitude' : references must be initialized
please the experienced users,help me.HOW CAN I INITIALIZE THAT REFERENCE "altitude"? i dont find it,if u know please tell me.
or u can also help me in another way;
imagine the same code but i define altitude just before the button click ,like;
.
.
double& altitude;
private: System::Void button1_Click(System::Object * sender, System::EventArgs * e)
{
.
.
and in this case it has an error as:
d:\c++\samples\lbox\list\Form1.h(25): error C2758: 'list::Form1::altitude' : must be initialized in constructor base/member initializer list
HOW CAN I INITIALIZE THAT REFERENCE IN CONSTRUCTOR BASE/MEMBER INITIALIZER LIST?
THANK U FOR YOUR CONSIDERATION.