#include <iostream>
#include <vector>
#include <cmath>

int main(int argc, char* argv[])
{
	// an integer size of vectors
	int n;
	// three vectors
	std::vector<double> a,b,c;
	// make them large
	n=10000000;
	a.resize(n);b.resize(n);c.resize(n);
	// now do some calculations and copies
	for(int i=0;i<n;i++)
		a[i] = sin(i*0.001);
	for(int i=0;i<n;i++)
		b[i] = cos(i*0.001);
	for(int i=0;i<n;i++)
		c[i] = a[i]*a[i] + b[i]*b[i];
    //	vector copies
	a=c;
	b=c;
	// more calculations
	double sum=0.;
	for(int i=0;i<n;i++)sum+=a[i]+b[i]+c[i];
	std::cout << " sum = " << sum << std::endl;
	// answer should be 30000000
	system("pause");
	return 0;
}