fork download
  1. #include <bits/stdc++.h>
  2. #include <ostream>
  3. using namespace std;
  4.  
  5. class fraction{
  6. private:
  7. int num, den;
  8. public:
  9. fraction(){
  10. num = 0;
  11. den = 0;
  12. }
  13. fraction(int num_, int den_){
  14. num = num_;
  15. den = den_;
  16. }
  17. friend ostream & operator << (ostream &os, fraction t ){
  18. cout << t.num << '/' << t.den << "\n";
  19. return os;
  20. }
  21. };
  22.  
  23.  
  24. int main () {
  25. ios_base::sync_with_stdio(false);
  26. cin.tie(NULL);
  27.  
  28. int num, den;
  29. cin >> num >> den;
  30. cout << fraction(num, den);
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
hello, world!