Advertisement
shabaduday

Forgetful Lucy

Feb 19th, 2015
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.    char c; int n;
  6.    while(cin >> c >> n)
  7.    {
  8.       if(n <= 0)
  9.          cout << "invalid input" << endl;
  10.       else
  11.       {
  12.          string *array = new string[n];
  13.          *array = c;
  14.          for(int i = 1; i < n; i++)
  15.          {
  16.             *(array + i) = *(array + i - 1) + c;
  17.          }
  18.          for(int i = 0; i < n; i++)
  19.          {
  20.             cout << *(array + i) << " ";
  21.          }
  22.          cout << endl;
  23.          delete[] array;
  24.       }
  25.    }
  26.    return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement