#include <iostream>
using namespace std;
class Hospital
{
public:
int bill(int room, int days)
{
long tot;
tot=room*days;
return tot;
}
float bill(float medicines,float days)
{
long tot;
tot=medicines*days;
return tot;
}
};
int main() {
Hospital ob;
int medicines,rooms,days;
cin>>medicines>>days>>rooms>>days;
cout<<endl<<ob.bill(medicines,days);
cout<<endl<<ob.bill(rooms,days);
return 0;
}
using namespace std;
class Hospital
{
public:
int bill(int room, int days)
{
long tot;
tot=room*days;
return tot;
}
float bill(float medicines,float days)
{
long tot;
tot=medicines*days;
return tot;
}
};
int main() {
Hospital ob;
int medicines,rooms,days;
cin>>medicines>>days>>rooms>>days;
cout<<endl<<ob.bill(medicines,days);
cout<<endl<<ob.bill(rooms,days);
return 0;
}
not working
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDelete//This code is working
ReplyDelete#include
#include
using namespace std;
class Hospital
{
public:
float bill(float medicines, float days)
{
float sum = medicines * days;
return sum;
}
int bill(int room, int days)
{
int sum = room * days;
return sum;
}
};
int main()
{
Hospital ob;
float a, b;
cin >> a >> b;
float sum1 = ob.bill(a, b);
cout << sum1 << endl;
cin >> a >> b;
float sum2 = ob.bill(a, b);
cout << sum2 << endl;
return 0;
}
you forgot to mention the proper include statements.
Delete#include
works.
#include
Deleteusing namespace std;
class Hospital
{
public:
float bill(float medicines, float days)
{
float sum = medicines * days;
return sum;
}
int bill(int room, int days)
{
int sum = room * days;
return sum;
}
};
int main()
{
Hospital ob;
float a, b;
cin >> a >> b;
float sum1 = ob.bill(a, b);
cout << sum1 << endl;
cin >> a >> b;
float sum2 = ob.bill(a, b);
cout << sum2 << endl;
return 0;
}
#include
ReplyDeleteusing namespace std;
class Hospital
{
public:
float bill(float medicines, float days)
{
float sum = medicines * days;
return sum;
}
int bill(int room, int days)
{
int sum = room * days;
return sum;
}
};
int main()
{
Hospital ob;
float a, b;
cin >> a >> b;
float sum1 = ob.bill(a, b);
cout << sum1 << endl;
cin >> a >> b;
float sum2 = ob.bill(a, b);
cout << sum2 << endl;
return 0;
}
#include
ReplyDeleteusing namespace std;
class Box
{
double width, height, depth;
public:
Box()
{
width = 0;
height = 0;
depth = 0;
}
Box(double samevalue)
{
width = samevalue;
height = samevalue;
depth = samevalue;
}
double volume()
{
return width * height * depth;
}
};
int main()
{
Box mybox1;
double a, vol;
cout << mybox1.volume() << endl;
cin >> a;
Box mybox2(a);
vol = mybox2.volume();
cout << vol;
return 0;
}