/*
CS371p: Quiz #13 (5 pts)
*/
/* -----------------------------------------------------------------------
1. What is the output of the following program?
(4 pts)
A()
A(A) A(A) A(A) A(A) A(A)
A(A) A(A) A(A) ~A() ~A()
~A() ~A() ~A() ~A() ~A() ~A() ~A()
*/
#include <iostream> // cout, endl
#include <vector> // vector
using namespace std;
struct A {
A () {
cout << "A() ";}
A (const A&) {
cout << "A(A) ";}
~A () {
cout << "~A() ";}
A& operator = (const A&) {
cout << "=(A) ";
return *this;}};
int main () {
{
A x;
cout << endl;
vector<A> y(3, x);
vector<A> z(2, x);
cout << endl;
z = y;
cout << endl;
}
cout << endl;
return 0;}
syntax highlighted by Code2HTML, v. 0.9.1