Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication1.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <vector>
- #include <algorithm>
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int fib()
- {
- static int a = 0;
- static int b = 1;
- int s = a + b;
- a = b;
- return b = s;
- }
- int _tmain(int argc, _TCHAR* argv[])
- {
- vector<int> a(10);
- generate(a.begin(), a.end(), fib);
- for (auto x:a)
- {
- cout << setw(4) << x << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement