#include <iostream>
using namespace std;
class Decimal
{
float a;
public:
void in()
{
cin>>a;
}
void operator ++()
{
a=a+0.10;
cout<<a;
}
};
int main() {
Decimal obj;
obj.in();
obj.operator ++();
return 0; }
using namespace std;
class Decimal
{
float a;
public:
void in()
{
cin>>a;
}
void operator ++()
{
a=a+0.10;
cout<<a;
}
};
int main() {
Decimal obj;
obj.in();
obj.operator ++();
return 0; }
1,2,3,4,5 test case is failed
ReplyDeleteThis comment has been removed by the author.
ReplyDelete#include
ReplyDeleteusing namespace std;
class Decimal
{
float a;
public:
void in()
{
cin>>a;
}
void operator --()
{
a=a-0.10;
cout<<a;
}
};
int main() {
Decimal obj;
obj.in();
obj.operator --();
return 0;
}
just give space after operater
ReplyDeleteits operator ++ not operator++