advise
Just trying to see understand what was done incorrectly
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
#include<iostream>
using namespace std;
class account
{
public:
account()
{
ID = 0;
SALARY = 0;
cout<<"constructor "<<endl;
}
~ account()
{
cout<<"deconstructor "<<endl;
system("pause");
}
void total()
{
cout<<"Account contains "<<SALARY<<endl;
cout<<"For User Number "<<ID<<endl;
}
double setSALARY(double SALARYin)
{
SALARY = SALARYin;
}
double getSALARY()
{
return SALARY;
}
double setID(double IDin)
{
ID = IDin;
}
double getID()
{
return ID;
}
private:
double ID;
double SALARY;
};
int main()
{
account myaccount;
double SALARYin;
cout<<"enter salary"<<endl;
cin>>SALARYin;
myaccount.setSALARY(SALARYin);
double IDin;
cout<<"enter ID"<<endl;
cin>>IDin;
myaccount.setID(IDin);
system("pause");
return 0;
}
|
What is wrong?
What do you expect?
The only small poblem is that setSALARY and setID don't return a value. Would be better to declare them as void.
HEY @THOMAS1965,
THANK YOU HELPING. i got a few points taken off and i wanted to know. she is not cleared in explaining your error so i thought this site could help
Topic archived. No new replies allowed.