What happens when you attempt to compile and run the following code?
#include
#include
int main ()
{
int t[]={1,2,3,4,5};
std::vector
std::vector
v1.resize(10);
v2.reserve(10);
std::vector
while (i != v1.end()) { std::cout<<i[ii]<<" ";ii??;i++; }
i = v2.begin();ii=0;
while (i != v2.end()) { std::cout<<i[ii]<<" ";ii??;i++; }
return 0;
}
What happens when you attempt to compile and run the following code?
#include
#include
#include <algorithm>
using namespace std;
template
ostream & out;
Out(ostream & o): out(o){}
void operator() (const T & val ) { out<<val<<" "; } };
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_difference(t1,t1+5,t2,t2+5,v1.begin());
for_each(v1.begin(), v1.end(), Out
return 0;
}
Program outputs: