Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1.  
  2. #include "pch.h"
  3. #include <iostream>
  4. #include <vector>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. vector<int> line;
  10. cout << "Enter the string from Pascal's triangle. Print any char to complete input and press enter." << endl;
  11. int x;
  12. while (cin >> x) {
  13. line.push_back(x);
  14. }
  15. for (int i = 1; i < line.size(); i++)
  16. {
  17. line[i - 1] = line[i - 1] + line[i];
  18. }
  19. line.emplace(line.begin(), 1);
  20. cout << "Next string from Pascal's triangle is: " << endl;
  21. for (int i = 0; i < line.size(); i++)
  22. {
  23. cout << line[i] << " ";
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement