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

Untitled

By: a guest on Aug 10th, 2012  |  syntax: None  |  size: 0.63 KB  |  hits: 25  |  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. Sublime Text with console input for c   programs
  2. #include <iostream>
  3. int main()
  4. {
  5.     int a, b, c;
  6.     std::cout << "Enter: ";
  7.     std::cin >> a >> b;
  8.     c = a + b;
  9.     std::cout << a << '+' << b << '=' << c << std::endl;
  10.     return 0;
  11. }
  12.        
  13. #include <iostream>
  14. #include <fstream>
  15.  
  16. #define SUBLIME
  17.  
  18. #if defined SUBLIME
  19. #  define ISTREAM ifile
  20. #else
  21. #  define ISTREAM std::cin
  22. #endif
  23.  
  24. int main()
  25. {
  26.     int a, b, c;
  27.     std::cout << "Enter: ";
  28.     #if defined (SUBLIME)
  29.       std::ifstream ifile("stdin.input");
  30.     #endif
  31.     ISTREAM >> a >> b;
  32.     c = a + b;
  33.     std::cout << a << '+' << b << '=' << c << std::endl;
  34.     return 0;
  35. }