Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #ifndef __MEU_H_INCLUDED__
- #define __MEU_H_INCLUDED__
- #include <stdlib.h>
- #include <iostream>
- #include <iomanip>
- #include <string>
- #include <vector>
- void imprime(std::vector<int>& v);
- void fibonacci(int x, int y, std::vector<int> fi, int numeroElementos);
- #endif
- #include "stdafx.h"
- #include "meu.h"
- using std::cout;
- using std::endl;
- void imprime(std::vector<int>& v)
- {
- for(int x = 0; x < v.size(); x++)
- cout << v[x];
- }
- void fibonacci(int x, int y, std::vector<int> fi, int numeroElementos)
- {
- int z = 0;
- for (int b = 0; b <= numeroElementos; b++)
- {
- z = x + y;
- fi.push_back(z);
- x = y;
- y = z;
- }
- }
- #include "stdafx.h"
- #include "meu.h"
- int main()
- {
- int valor1 = 0;
- int valor2 = 0;
- int NumeroElementos = 0;
- std::vector<int> numeros;
- while (std::cin >> valor1 >> valor2 >> NumeroElementos) {
- fibonacci(valor1, valor2, numeros, NumeroElementos);
- imprime(numeros);
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement