Decimal in decimal : int output « Data Type « C++






Decimal in decimal

  
#include <iostream>

using namespace std;

int main()
{
  int x = 100;
  double f = 98.6;
  double f2 = 123456.0;
  double f3 = 1234567.0;

  cout.setf(ios::dec, ios::basefield);
  cout << "x in decimal: " << x << "\n\n";

  return 0;
}
  
    
  








Related examples in the same category

1.Decimal in hexadecimal
2.Decimal in octal
3.Display decimal value as hexadecimal value
4.Display decimal value as Octal value
5.Output integer with different base: 8, 10, 16
6.Right justification
7.Left justification
8.Use .(dot) as place holder
9.Set width of output
10.Using hex, oct, dec and setbase stream manipulators.
11.Printing an integer with internal spacing and forcing the plus sign.
12.Set showpos flag for decimal
13.Making I/O in Octal Format