fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. unsigned int nominator, denominator;
  6. char sep;
  7. cin >> nominator >> sep >> denominator;
  8.  
  9. if (!cin || sep != '/') {
  10. cerr << "Well... you know, that failed somehow." << endl;
  11. return 1;
  12. }
  13. cout << "Fraction: " << nominator << "/" << denominator << endl;
  14. return 0;
  15. }
Success #stdin #stdout 0s 3472KB
stdin
3/4
stdout
Fraction: 3/4