Statements


Managed C++'s most basic element is the statement. A statement is a coding construct that performs a single Managed C++ action. You will learn about different types of statements as you progress through this book, but the main thing to remember about all statements is that they end with a semicolon (;). If you forget the semicolon, your compiler will throw up all over you. Here are some statements:

 using namespace System; System::Console::WriteLine(S"Hello Managed World"); Boolean IsOpen; y = GetYCoord(); 

Not much to look at, are they?

Managed C++ provides a construct for compound statements. To create a compound statement, you simply enclose several simple statements within curly brackets:

 {     x = x + y;     PrintAnswer(x); } 

These statements execute as a group and can be placed anywhere a simple statement can be placed. You will see them in the "Flow Control Constructs" and "Looping Constructs" sections later in this chapter.




Managed C++ and. NET Development
Managed C++ and .NET Development: Visual Studio .NET 2003 Edition
ISBN: 1590590333
EAN: 2147483647
Year: 2005
Pages: 169

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net