What happens when you attempt to compile and run the following code?
#include
#include
#include
#include
#include
using namespace std;
class A {
int a;
public:
A(int a):a(a) {}
int getA() const { return a;} void setA(int a){ this?>a = a;}
bool operator < ( const A & b) const { return a }; struct display { void operator() (const A & a) {cout << " " << a.getA();} }; struct add10 { void operator() (A & a) { a.setA(a.getA()+10) ;} }; int main() { int t[] = { 10, 5, 9, 6, 2, 4, 7, 8, 3, 1 }; vector v1(t, t + 10); set s1(t, t + 10); for_each(v1.begin(), v1.end(), add10()); for_each(v1.begin(), v1.end(), display()); for_each(s1.begin(), s1.end(), add10()); for_each(s1.begin(), s1.end(), display()); return 0; }
Emily
4 hours agoErasmo
2 days agoMickie
4 days agoLevi
5 days agoMalissa
6 days agoWayne
7 days agoMalissa
14 days ago