What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
template
public:
B(T v):val(v){}
T getV() const {return val;} bool operator < (const B & v) const { return val template template ostream & out; Out(ostream & o): out(o){} void operator() (const T & val ) { out< bool Less(const B int main() { float t[]={2.28, 1.66, 1.32, 3.94, 3.64, 2.3, 2.98, 1.96, 2.62, 1.13}; vector > v1; v1.assign(t, t+10); stable_sort(v1.begin(), v1.end(), Less); for_each(v1.begin(), v1.end(), Out >(cout));cout<<endl; return 0; } Program outputs:
What will happen when you attempt to compile and run the following code?
#include
#include
using namespace std;
int main ()
{
float f = 10.126;
cout.unsetf(ios::floatfield);
cout<<scientific< return 0; } What will be a mantissa part of the numbers displayed:
What happens when you attempt to compile and run the following code?
#include
#include
#include
#include
using namespace std;
class B { int val;
public:
B(int v=0):val(v){}
int getV() const {return val;}
operator int () const { return val;} };
ostream & operator <<(ostream & out, const B & v) { out< template ostream & out; Out(ostream & o): out(o){} void operator() (const T & val ) { out< int main() { B t[]={3,2,4,1,5,6,10,8,7,9}; vector v1(t, t+10); transform(v1.begin(), v1.end(), v1.begin(), bind2nd(plus(), 1)); for_each(v1.rbegin(), v1.rend(), Out(cout));cout<<endl; return 0; } Program outputs:
What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
class B { int val;
public:
B(int v=0):val(v){}
int getV() const {return val;}
operator int () const { return val;} };
template
ostream & out;
Out(ostream & o): out(o){}
void operator() (const T & val ) { out< struct Add { B operator()(B & a, B & b) { return a+b; }}; int main() { int t[]={1,2,3,4,5,6,7,8,9,10}; vector v1(t, t+10); vector v2(10); transform(v1.begin(), v1.end(), v2.begin(), bind1st(Add(),1)); for_each(v2.rbegin(), v2.rend(), Out(cout));cout<<endl; return 0; } Program outputs: