The negative of a variable that contains a negative value. - C++ Data Type

C++ examples for Data Type:int

Description

The negative of a variable that contains a negative value.

Demo Code

#include <iostream>
using namespace std;
int main()//from   w  w  w  .j av  a  2 s .c o m
{
   signed int temp=-12;  // 'signed' is not needed because it is the default.
   cout << -temp << "\n";  // Produces a 12 on-screen.
   return 0;
}

Result


Related Tutorials