C++.


         

,


                  .

, showbase:











#include <iostream>

int main()

{

int ival = 16;

double dval = 16.0;

cout << showbase;



cout << "ival: " << ival

<< " oct: " << oct << ival << "\n";

cout << "dval: " << dval

<< " hex: " << hex << dval << "\n";

cout << "ival: " << ival

<< " dec: " << dec << ival << "\n";

cout << noshowbase;



}

:

ival: 16 oct: 020

dval: 16 hex: 16

ival: 0x10 dec: 16

noshowbase

cout, .

6. - precision(int) setprecision(); iomanip. precision()

. :











#include <iostream>

#include <iomanip>

#include <math.h>

int main()

{

cout << ": "

<< cout.precision() << endl

<< sqrt(2.0) << endl;

cout.precision(12);

cout << "\n: "

<< cout.precision() << endl

<< sqrt(2.0) << endl;

cout << "\n: " << setprecision(3)

<< cout.precision() << endl

<< sqrt(2.0) << endl;

return 0;

<