中国大学MOOC:"如下程序的输出是什么____#include #include using namespace std;struct MyException : public exception{ const char * what () const throw () { return "C++ Exception"; }};int main(){ try { throw MyException(); } catch(MyException& e) { std::cout << "MyException" << std::endl; } catch(std::exception& e) { std::cout<<"exception" << std::endl; }}";
举一反三
- 以下代码写法哪个不符合工程规范? A: using namespace std; B: using std::endl; C: std::cout << "Hello"; D: using std::endl;,std::cout << endl;
- 以下代码写法哪个不符合工程规范? A: using namespace std; B: using std::endl; C: std::cout << "Hello"; D: using std::endl;std::cout << endl;
- 下面代码中,第7行横线处应该填入class MyExcept {}; int main() { try { MyExcept ex; throw ex; } catch (________) { } return 0; } A: MyExcept &e B: MyExcept *e C: MyExcept ~e D: std::exception e E: std::exception &e
- 下面代码中,第7行横线处应该填入class MyExcept {}; int main() { try { MyExcept ex; throw ex; } catch (________) { } return 0; } A: MyExcept &e B: MyExcept *e C: MyExcept ~e D: std::exception e E: std::exception &e
- 中国大学MOOC: 下面程序输出结果为:#include<iostream>using namespace std;#include<string.h>int main( ){ char st[20]="hello\0\t\\"; cout<<strlen(st); cout<<sizeof(st)<<endl; cout<<st; return 0;}