Which changes introduced independently will allow the code to compile and display ''one'' ''eight'' ''nine'' ''ten''? Choose all that apply.
#include
#include
#include
using namespace std;
class A {
int a;
public:
A(int a):a(a){}
int getA() const { return a;}
/* Insert Code Here 1 */
};
/* Insert Code Here 2 */
int main(){
int t[] ={ 3, 4, 2, 1, 6, 5, 7, 9, 8, 10 };
string s[] = {"three", "four", "two", "one", "six","five", "seven", "nine","eight","ten"};
multimap m;/* Replace Code Here 3 */
for(int i=0; i<10; i++) {
m.insert(pair(A(t[i]),s[i]));
}
m.erase(m.lower_bound(2),m.upper_bound(7));
multimap::iterator i=m.begin();/* Replace Code Here 4 */
for( ; i!= m.end(); i++) {
cout<second<<" ";
}
cout< return 0; }
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):val(v){}
int getV() const {return val;} bool operator > (const B & v) const { return val>v.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,10,9,7,8,6}; vector v1(t,t+10); sort(v1.begin(), v1.end(), greater()); cout<<*min_element(v1.begin(), v1.end()); return 0; } Program outputs:
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int main()
{
cout.setf(ios::oct, ios::basefield);
cout<<100<<" ";
cout.setf(ios::showbase);
cout<<100<<" ";
return 0;
}
Program outputs:
What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
template
ostream & out;
Out(ostream & o): out(o){}
void operator() (const T & val ) { out< int main() { int t1[]={3,2,4,1,5}; int t2[]={5,6,8,2,1}; vector sort(t1, t1+5); sort(t2, t2+5); set_union(t1,t1+5,t2,t2+5,v1.begin()); for_each(v1.begin(), v1.end(), Out return 0; } Program outputs:
What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
int main () {
int t[] = {1,2,3,4,5,1,2,3,4,5};
vector
vector
int m1[] = {1, 3, 2};
it = find_first_of (v.begin(), v.end(), m1, m1+3);
cout << "First found at position: " << it?v.begin() << endl;
return 0;
}