我正在参加C++编程课程,教授告诉我们没有必要学习C语言,因为C++包含C语言中的所有内容以及面向对象的特性.然而,其他一些人告诉我,这不一定是真的.任何人都可以对此有所了解吗?
在使用 try-catch 时遇到了这个错误。但我无法查出这个错误的原因,尽管我上网冲浪,所以。
\n\n我的代码是...
\n\nint main()\n{\nQueue q;\nint choice,data;\n\n while(1)\n {\n choice = getUserOption();\n switch(choice)\n {\n case 1:\n cout<<"\\nEnter an element:";\n cin>>data;\n q.enqueue(data);\n break;\n case 2:\n int element;\n element = q.dequeue();\n cout<<"Element Dequeued:\\n"<<element;\n break;\n case 3:\n q.view();\n break;\n case 4:\n exit(EXIT_SUCCESS);\n }\n catch(UnderFlowException e)\n {\n cout<<e.display();\n }\n catch(OverFlowException e)\n {\n cout<<e.display();\n }\n\n }// end of while(1)\n\n return 0;\n}\nRun Code Online (Sandbox Code Playgroud)\n\n对我来说,上面代码中的所有内容似乎都是正确的。但是 g++ 编译器正在抛出......
\n\nmuthu@muthu-G31M-ES2L:~/LangFiles/cppfiles/2ndYearLabException$ g++ ExceptionHandlingEdited.cpp\nExceptionHandlingEdited.cpp: In member function \xe2\x80\x98void Queue::enqueue(int)\xe2\x80\x99:\nExceptionHandlingEdited.cpp:89:97: warning: deprecated conversion from string constant …Run Code Online (Sandbox Code Playgroud)