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< 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< struct Add { int operator()(int & a, int & b) { return a+b; } }; int main() { int t[]={1,2,3,4,5,6,7,8,9,10}; vector vector transform(v1.begin(), v1.end(), v2.begin(), bind1st(1,Add())); for_each(v2.rbegin(), v2.rend(), Out return 0; } Program outputs:
What happens when you attempt to compile and run the following code?
#include
#include
#include
#include
#include
using namespace std;
int main()
{
deque
queue
queue
fourth.push(10);fourth.push(11);fourth.push(12);
queue
fifth.push(10);fifth.push(11);fifth.push(12); // Line I
while(!fifth.empty())
{
cout< fifth.pop(); // Line III } while (!fourth.empty()) { cout << fourth.front() << " "; fourth.pop(); // Line IV } return 0; }
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, 6 , 7, 8 , 9, 10};
vector
deque
d1.empty();
v1.empty();
if (v1.isempty())
{
cout<<"I am empty ";
}
else
{
cout<<"I am not empty ";
}
cout< return 0; }
What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
int main(){
int second[] ={ 3, 4, 2, 1, 6, 5, 7, 9, 8, 10 };
string first[] = {"three", "four", "two", "one", "six","five", "seven", "nine","eight"," ten"};
multimap
for(int i=0; i<10; i++) {
m.insert(pair
}
if (m[11] == "eleven") {
cout<<"eleven ";
}
for(multimap
cout<second<<" ";
}
cout< return 0; }
Stanford
3 days agoYuette
10 days agoDallas
13 days agoIndia
28 days agoAleisha
29 days agoRoselle
1 months agoVincenza
1 months agoLyda
2 months agoNoah
2 months agoMammie
2 months agoThea
4 months agoArlean
4 months agoMargarita
5 months ago