Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. char napis[5] = "abcd";
  6. cout << "Ile spacji na poczatek chcesz dodac?";
  7. int liczba;
  8. cin >> liczba;
  9. char napis2[5 + liczba];
  10. int x = 0;
  11. for (int i = 0; i < 5 + liczba; i++) {
  12. if (i >= liczba) {
  13. napis2[i] = napis[x];
  14. x++;
  15. }
  16. else
  17. napis2[i] = ' ';
  18. }
  19. for (int i = 0; i < 5 + liczba; i++)
  20. cout << napis2[i];
  21. cout<<endl;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement