Hi,

I'm having some trouble trying to convert integer values from positive to negative and vice versa.

Here's an example of what I mean:

= 10 convert to -10

= -10 conver to 10

Here's my code:

Code:#include "Number.h" #include <iostream> using std::cout; int main() { Number num; num.setNum(7); cout << "Number: is " << num.getNum() << "\n"; return 0; }Code:#ifndef NUMBER_H #define NUMBER_H class Number { public: Number(); void setNum(const int &n); int getNum(); int negation(int value); private: int num; }; #endifCode:#include "Number.h" Number::Number() { this->num = num; } void Number::setNum(const int &n) { this->num = negation(n); } int Number::getNum() { return num; } int Number::negation(int value) { if(value < 0) { value > value; } if(value > 0) { value < value; } return value; }