6
Loading subject content…
Loading subject content…
Loading practice questions…
What will be the output of the program?
#include <iostream>
using namespace std;
struct M {
int v;
bool operator==(const M &o) const { return v == o.v; }
};
int main() {
M a{3}, b{3}, c{4};
cout << (a == b) << (a == c) << endl;
return 0;
}What will be the output of the program?
#include <iostream>
using namespace std;
struct A {
int d[3] = {7, 8, 9};
int &operator[](int i) { return d[i]; }
};
int main() {
A a;
a[1] = 50;
cout << a[0] + a[1] << endl;
return 0;
}