Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <vector>
- using namespace std;
- int main()
- {
- vector<int> line;
- cout << "Enter the string from Pascal's triangle. Print any char to complete input and press enter." << endl;
- int x;
- while (cin >> x) {
- line.push_back(x);
- }
- for (int i = 1; i < line.size(); i++)
- {
- line[i - 1] = line[i - 1] + line[i];
- }
- line.emplace(line.begin(), 1);
- cout << "Next string from Pascal's triangle is: " << endl;
- for (int i = 0; i < line.size(); i++)
- {
- cout << line[i] << " ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement