Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 11th, 2012  |  syntax: C++  |  size: 0.63 KB  |  hits: 33  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #define PLATFORM_IOS (defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR))
  2. #define PLATFORM_OSX (defined(__APPLE__) && !PLATFORM_IS_IOS)
  3. #define PLATFORM_WINDOWS defined(_WIN32)
  4. #include <iostream>
  5.  
  6. /*
  7.  * This code outputs "What am I doing wrong?!?!?" and then "Cows!"
  8.  * I think it should output "Hoorah!" and then "Cows!"
  9.  * Why doesn't it?
  10. */
  11.  
  12. int main()
  13. {
  14. #if PLATFORM_WINDOWS
  15.         std::cout << "Hoorah!" << std::endl;
  16. #else
  17.         std::cout << "What am I doing wrong?!?!?" << std::endl;
  18. #endif
  19. #if defined(_WIN32)
  20.         std::cout << "Cows!" << std::endl;
  21. #else
  22.         std::cout << "Organs!" << std::endl;
  23. #endif
  24.         system("pause");
  25. }