answersLogoWhite

0

A statement may be simple or compound. The following examples are all simple statements:

int i=1;

i++;

std::cout<<i<<std::endl;

Note that a simple statement ends with a semi-colon.

A compound statement is a group of simple statements enclosed in braces. Compound statements usually begin with an opening statement, such as for, if, switch, etc.

for(int i=0; i<10; ++i)

{

int j=i*i;

std::cout<<j<<std::endl;

}

In this example, the compound statement begins with the for keyword and ends at the closing brace. Everything between the braces is treated as a single statement composed from simple statements. If there were only one simple statement, the braces would be optional, but the statement would still be regarded as a compound statement.

The comma operator can also be used to form compound statements (braces are neither required nor implied):

int i=1, j=2;

The compiler treats this as if it were written in full:

int i=1;

int j=2;

User Avatar

Wiki User

11y ago

What else can I help you with?

Related Questions

Which statement is not frequently used in C plus plus?

The goto statement.


What is the deffernce of the switch statement and the if statement in c plus plus?

If statement is single selection statement,whereas the switch statement is multiple selective.


Basic control structure available in c plus plus?

The basic control structure in C++ is the if statement.


A c plus plus statement that invokes a function is known as?

...a function call.


Which statement in C plus plus is used to implement a decision structure in its simplest form-that of choosing between two alternatives?

if (condition) statement else statement;


What is the function of visual c plus plus switch condition?

The switch / case statement.


What is the character used at the end of executable statements in C plus plus?

The semi-colon converts a C++ expression into a statement.


How can write the name in c plus plus language without using cout statement?

I believe, you can use C-function - printf().


How can you print your name in c or c plus plus with out using semi column?

You can not print your name in C without a semi colon because according to the rules of C every statement should end with a semi colon.In fact without the semi colon it fails to be a valid C statement.


Can you write plus at end of c statement?

No. That would be a syntax error. Only a right semicolon (;) can go at the end of a statement.


What statement describes the function c equals 5g plus 8?

It is an equation in two variables, c and g.


What are the conditional statement of turbo c plus plus dos based?

Statements that check an expression then may or may not execute a statement or group of statements depending on the result of the condition.