I want to turn all flags on with a loop.I tried to do it like this,
#include<iostream>
using namespace std;
void showflags()
{
// ios::fmtflags f;
long f=cout.flags();
long i;
for(i=16384;i;i=i>>1)
if(i&f)
cout<<"1 ";
else cout<<"0 ";
cout<<endl;
}
void setallflag()
{
ios_base::fmtflags f,i=16384;
for(;i;i>>=1)
f=f|i;
cout.flag(f);
}
main()
{
showflags();
setallflag();
showflags();
}
but it gives me an error saying "invalid conversion from int to std::ios_base::fmtflags.
I want to know why this error occurs and how to fix it.