Expressions in C++ (Day ten) -1

Expressions in C++ An expression in C++ is any valid combinations  of operators, constants and variables . The expressions in C++ can be of any type :

  • Arithmetic Expression
  • Relational Expression (or Logical Expression)
  • Compound Expressions etc.
Arithmetic Expressions can be either Integer Arithmetic Expression or Real Expressions or mixture of both. Integer Constants are made up of integer constants and/or integer variable Real Expressions are made up of real constants and/or real variables Examples of integer Expressions and Real Expressions – Expressions in C++ Logical Expressions are the expressions that results o(false) or 1(True). These expressions are combination of constants, variables and logical and relational operators. Examples of some valid Logical Expressions are – Logical Expressions in C++ Assignment Statements – These statements assigns a value to a variable. The value assined may be a constant variable or an expression. These can be chained together also. For Example, Assignment Statements(Expresions in C++) In the above chained assignment statement, value 13 is assigned to all the variables x,y,z. Firstly, 13 is assigned to z, then the new value of z is assigned to y, and finally the new value of y is assigned to x.  ]]>

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top