yup, i missed that part.. i'm one of those people who don't read rules but anyway, it makes more fun if you do by yourself and btw, i didn't need for homework or something like that..i was just interested how would someone else do the same program.
Code:
#include <iostream>
using namespace std;
class Bulb{
private:
bool Balance;
public:
Bulb(){Balance=false;};
void PushTheButton (){
Balance=!Balance;
}
void Check (){
if (!Balance)
cout<<"Dark!"<<endl;
else
cout<<"Light!"<<endl;
}
};
int main (){
bool Balance;
Bulb Turning;
Turning.PushTheButton();
Turning.Check ();
Turning.PushTheButton();
Turning.Check ();
system ("pause");
return 0;
}
Code:
#include <iostream>
using namespace std;
class Employees{
friend float Earning (Employees&);
private:
float path;
float age;
float wages;
public:
Employees (float,float,float);
~Employees();
float Path(){return path;}
float Age () {return age;}
float Wages () {return wages;}
};
float Earning (Employees &earned){return (earned.path*earned.age*earned.wages);}
//constructor
Employees::Employees(float Path,float Age, float Wages){
path=Path;
age=Age;
wages=Wages;
}
//destructor
Employees::~Employees (){
cout<<"Destructor employees - fired!"<<endl;
}
int main (){
Employees A(12,5,3000);
cout<<"Employee has earned:"<<Earning (A)<<endl;
system ("pause");
return 0;
}
and btw, sorry for my "not reading"