相关疑难解决方法(0)

因为C++包含所有东西,所以不需要学习C是真的吗?

我正在参加C++编程课程,教授告诉我们没有必要学习C语言,因为C++包含C语言中的所有内容以及面向对象的特性.然而,其他一些人告诉我,这不一定是真的.任何人都可以对此有所了解吗?

c c++

44
推荐指数
4
解决办法
1万
查看次数

C代码仍然被认为是C++吗?

这个答案的评论让我感到疑惑.我一直认为C是C++的一个合适的子集,也就是说,任何有效的C代码都是有效的C++代码.我错了吗?是否可以编写一个无效的C++代码的有效C程序?

编辑:这与此问题非常相似,但不完全相同.

c c++

10
推荐指数
5
解决办法
2143
查看次数

代码中的这个错误是什么?

在使用 try-catch 时遇到了这个错误。但我无法查出这个错误的原因,尽管我上网冲浪,所以

\n\n

我的代码是...

\n\n
int 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}\n
Run Code Online (Sandbox Code Playgroud)\n\n

对我来说,上面代码中的所有内容似乎都是正确的。但是 g++ 编译器正在抛出......

\n\n
muthu@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)

c++ compiler-errors try-catch

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

c++ ×3

c ×2

compiler-errors ×1

try-catch ×1