Demonstrate resize() for deque
#include <iostream>
#include <deque>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
deque<double> dequeObject1, dequeObject2;
double num;
int i;
for(;;) {
cout << "Enter angles (0 to stop): ";
cin >> num;
if(num == 0.0) break;
dequeObject1.push_back(num);
}
dequeObject2.resize(dequeObject1.size());
for(i = 0; i <dequeObject2.size(); i++) {
cout << "Angle and sine: ";
cout << dequeObject1[i] << " " << dequeObject2[i];
cout << endl;
}
cout << endl;
return 0;
}
Related examples in the same category