answersLogoWhite

0


Best Answer

if (conditional_statement) {

//Code to execute if true

}

if (conditional_statement) {

//Code to execute if true

} else {

//Code to execute if false

}

if (conditional_statement) {

//Code to execute if true

} else if (another_conditional_statement) {

//Code to execute of the second conditional statement is true

} else {

//Code to execute if neither statement is true

}

There are a few things to note about if statements that might be helpful:

  • You can have as many 'else if' declarations in an 'if' statement as you want (These are called stacked if's)
  • You can specify an if statement without the curly braces ('{' and '}') if there is only one line of code. For example:

    if (x > 10) x = 0;

    This will set x back to 0 if it is greater than 10, just like a normal 'if' statement but without the curly braces.

  • As a result of this, 'else if', to the compiler, is not special at all. An 'if/else-if/else' statement is actually just two 'if/else' statements stacked on top of one another, where the 'else' doesn't have curly braces (hence the term "stacked if statement").

    To demonstrate, the following two if statements are actually interpreted exactly the same by the compiler:

    if (x -10) {

    x = 0;

    } else {

    x++; //Increment x;

    }

    }

User Avatar

Wiki User

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What accurately describes the grammar of a conditional-statement in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

What is Easy Grammar Plus?

Easy Grammar Plus is a easy grammar homeschool curriculum by Wanda C. Phillips, Ed.D.


Why she avoid you?

Because of your terrible grammar. Plus you are quite sketchy.


What has the author M Kathleen Mahnke written?

M. Kathleen Mahnke has written: 'Mahnke, Grammar Links Text, 3, Volume B, With Workbook 3, Volume B, 2nd Editionplus Smarthinking' 'Grammar Links + Audio Cd + Workbook Level 2 2nd Ed' 'Grammar Links Text Level Three Volume B + Workbook Volume B + Cd Level Three 2nd Ed' 'Grammar Links Level 1 2nd Edition Plus Smarthinking' 'Grammar Links Level 3 2nd Ed + Smarthinking' 'Grammar Links One Volume B + Workbook Volume B + Level One Cd' 'Grammer Links Level 2 + Level 2 Audio Cd 2nd Ed' 'Grammar Links Level Three + Cassette + Workbook Level Three 2nd Ed' 'Grammar Links + Audio Cd + Workbook Level 1 2nd Ed + Smarthkinkin' 'Mahnke Grammar Links Level Two Plus Cassette Plus Workbook Level Two' 'Grammar Links Level 2 2nd Edition Plus Folse Blueprints #1' 'Grammar Links' 'Grammar Links Level Two + Cassette + Workbook Level Two 2nd Ed + Smarthinking' 'Mahnke, Grammar Links With Audio Cd, Level 3, 2nd Edition Plus Smarthinking' 'Grammar Links 2A' 'Grammar Links + Audio Cd + Workbook Level 3 2nd Ed + Smarthinking' 'Grammar Links Level 1 Plus Audio Cd Level 1 2nd Edition Plus Smarthinking'


What is IVA plus Plus diagnostic interpretive?

Go to braintrain website. It describes it all there.


What is the consequences if A plus men marries with O negative women?

You learn to use correct grammar?


Should of known proper grammar?

No! It is should HAVE plus the participle, often contracted to should've in speech.


Is nuclear reactors harm full?

your grammar is appalling! plus it's 'harmful' not 'harm full.'


What statement does not accurately describe the following equation C6H12O6 plus --- and 6H20 plus 6CO2 plus energy?

The chemical equation is:C6H12O6 + 6 O2 = 6 CO2 + 6 H2O


What describes of the supply of housing?

Inelastic brainly agrees plus me


What best describes a wave on A plus?

vibration of particles in a medium


What best describes the following equation 3x plus 14 equals 3x plus 24?

undefined.


What is 2xsquared plus 10x plus 25?

2x2 + 10x + 25 is a quadratic expression. It describes a parabola.