In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Editor to share with you the C++ sentence example analysis, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to understand it!
Drape else
Refers to the problem of how to find a matching if branch for else when the if branch is hiding from the else branch:
-C++ eliminates ambiguity by stipulating that the else matches the nearest unmatched if.
Switchswitch (ch) {case'asides: case'baked: + + n; break;}
Break jumps out of the switch control flow.
The case tag (case lable) must be an integer constant expression.
If a case tag matches, all branches will be executed sequentially from that tag, and will not stop until the end of the switch unless the process is interrupted as shown.
The statement after the case tag is braced with curly braces ({}) to define the variable within the block, thus ensuring that all subsequent case tags are outside the scope of the variable.
Default tag: a special case tag that executes the content under the default tag when the switch does not match all case.
Do whiledo statementwhile (condition); / / Note the semicolon
Variables are not allowed to be defined within a loop condition.
And the variables of the conditional part must be defined in extracorporeal circulation.
Jump statement break
Responsible for terminating the while, do while, for, or switch statements closest to it and starting execution from the first statement after those statements.
Continue
For 、 while 、 do while
Try statement blocks and exception handling
Throw expression (throw expression): the exception detection section uses an throw expression to indicate that it has encountered an unmanageable problem.
It is said that throw** threw a * * (raise) exception.
After an exception is thrown, the function is terminated and control is transferred to code that can handle the exception.
Try statement block (try block): try begins and ends with one or more catch clauses (catch clause).
An exception thrown by code in a try statement block is usually handled by a catch clause.
The catch clause is called exception handling code (exception handler).
Exception class (exception class)
Try {/ / program-statements} catch (/ * exception-declaration exception declaration * /) {/ / handler-statements} catch (/ * exception-declaration*/) {/ / handler-statements} / /.
The exception declaration specifies the type of exception that the catch clause can handle.
Standard anomaly
The C++ standard library defines a set of classes for reporting problems encountered by standard library functions.
In the following four header files:
-exception: defines the most general exception class, exception, which only reports the occurrence of exceptions and does not provide any additional information.
-stdexcept
Initialization using a string object or a C-style string
-there is only one member function what ()
Exception / / the most common problem
Runtime_error / / problems that can only be detected at run time
Overflow_error / /
Underflow_error
Logic_error
Domain_error
Invalid_arguement
Length_error
Out_og_range
-new:bad_alloc
-type_info:bad_cast
The above is all the content of this article "sample Analysis of C++ sentences". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.