Silverbullets

4/12 days of christmas

Aug 26th, 2015
481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. // Example program
  2. #include <iostream>
  3. #include <string>
  4. #include <cstdlib>
  5.  
  6. using namespace std;
  7.  
  8. string gifts[] = {"a Partridge in a pear tree.", "two Turtle Doves, ", "three French Hens, ", "four Calling birds"};
  9. string day[] = {"first","second","third","fourth"};
  10.  
  11. int main()
  12. {
  13.     for (int i = 0; i < 4; i++) {
  14.      cout << "On the " << day[i] << " day of Christmas my true love gave to me: " << endl;
  15.      for (int j = i; j >= 0; j--) {
  16.          if (j > 0) {
  17.             cout << gifts[j] << endl;
  18.         } else {
  19.             cout << "and " << gifts[j] << endl;
  20.         }
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment