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; }
Ressie
4 hours agoShaunna
5 days agoXuan
10 days agoChantay
16 days agoNathalie
21 days agoEmmett
26 days agoLeonor
1 month agoJohnson
1 month agoBrittani
1 month agoAja
2 months agoDana
2 months agoCristy
2 months agoDick
2 months agoLashawn
2 months agoVeronique
4 months agoRonna
4 months agoWillodean
4 months agoStephanie
4 months agoWilford
4 months agoXuan
5 months agoIlda
5 months agoOretha
5 months agoDoretha
5 months agoGenevive
5 months agoFreeman
5 months agoTamala
6 months ago