Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- char c; int n;
- while(cin >> c >> n)
- {
- if(n <= 0)
- cout << "invalid input" << endl;
- else
- {
- string *array = new string[n];
- *array = c;
- for(int i = 1; i < n; i++)
- {
- *(array + i) = *(array + i - 1) + c;
- }
- for(int i = 0; i < n; i++)
- {
- cout << *(array + i) << " ";
- }
- cout << endl;
- delete[] array;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement