fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <cstdlib>
  4. #include <ctime>
  5. #include <vector>
  6.  
  7. using namespace std;
  8.  
  9. void surpriseGift() {
  10. vector<string> gifts = {
  11. "a brand new bug in your code šŸž",
  12. "a lifetime supply of semicolons ;;;;;;;;;;;",
  13. "an infinite loop (you'll never age again!) šŸ”",
  14. "an IBSU T-Shirt"
  15. };
  16.  
  17. srand(time(0));
  18. int randomIndex = rand() % gifts.size();
  19. cout << "\nšŸŽ Surprise! You've won " << gifts[randomIndex] << "\n\n";
  20. cout << "(Run the program a few times to get different gifts)" << "\n\n";
  21. }
  22.  
  23. int main() {
  24. string name = "Guka";
  25. int age = 19;
  26.  
  27. cout << "\nšŸŽ‰šŸŽ‰ HAPPY BIRTHDAY, " << name << "! šŸŽ‰šŸŽ‰\n";
  28. cout << "I wish your next years in IBSU to be happy and productive\n";
  29. cout << "May you turn " << (100 + age) << " someday\n";
  30.  
  31. surpriseGift();
  32.  
  33. cout << "Have an amazing birthday, " << name << "!\n";
  34.  
  35. return 0;
  36. }
  37.  
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
šŸŽ‰šŸŽ‰ HAPPY BIRTHDAY, Guka! šŸŽ‰šŸŽ‰
I wish your next years in IBSU to be happy and productive
May you turn 119 someday

šŸŽ Surprise! You've won an infinite loop (you'll never age again!) šŸ”

(Run the program a few times to get different gifts)

Have an amazing birthday, Guka!