C++/Console/cout setiosflags — различия между версиями
Admin (обсуждение | вклад) м (1 версия: Импорт контента...) |
|
(нет различий)
|
Версия 14:21, 25 мая 2010
cout: set ios flags, ios::showpos, ios::showbase
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
cout << setiosflags(ios::showpos);
cout << setiosflags(ios::showbase);
cout << 123 << " " << hex << 123;
return 0;
}
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
cout << setiosflags(ios::showpos);
cout << setiosflags(ios::showbase);
cout << 123 << " " << hex << 123;
return 0;
}
Use setiosflags(): ios::showpos, ios::scientific
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
cout << setiosflags(ios::showpos) << setiosflags(ios::scientific)
<< 123 << " " << 123.23;
return 0;
}