fork download
  1. #include <iostream>
  2. using namespace std;
  3. double chia(int a, int b) {
  4. if( b == 0 ) {
  5. throw "Chia cho so khong!"; //Ngoại lệ kiểu string
  6. }
  7. return (a/b);
  8. }
  9.  
  10. throw 997; // Ngoại lệ kiểu int
  11. throw string("Bye world"); // Ngoại lệ kiểu string
  12. int main() {
  13. // your code goes here
  14. return 0;
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:10:2: error: expected unqualified-id before ‘throw’
  throw 997;     // Ngoại lệ kiểu int
  ^~~~~
prog.cpp:11:2: error: expected unqualified-id before ‘throw’
  throw string("Bye world"); // Ngoại lệ kiểu string
  ^~~~~
stdout
Standard output is empty