16 views

Uploaded by api-3769732

UNIT-2 4

- OSS 2marks With Answer
- saxon 54 se 3e
- Chapter 02-Computer Arithmetic
- Division Strategies
- Vedic Mathematics
- student teaching
- Vedic Mathematics BOOK 1 pdf.pdf
- Supporting your kids in Maths " Multiplication and Division
- mms9 text 03 unit3
- Binary Conversion Exercises
- strengthsandweaknessesofthefilipinocharacter-120520082929-phpapp01
- A_New_System_of_Arithmetic_and_Mathematics_1000016571.pdf
- 6 Programming with MATLAB.pdf
- 38848
- MATH103 Math for Todays World
- 05 01 02 Conditional Execution-Making Choices in Python VF
- MA1200 Chapter 3 Polynomials and Rational Functions
- Practice Solutions
- ACJC Promo Paper
- Emuneration Techniques_Gabriel Carroll

You are on page 1of 11

operator = so far. An operator is a symbol that tells the computer to

perform certain mathematical or logical manipulations. Operators are

used in programs to manipulate data and variables. They are usually

part of the mathematical or logical expressions. C++ operators

can be classified into following categories:

Arithmetic operators

Relational operators

Logical operators

Assignment operators

Increment and decrement operators

Conditional operators

Arithmetic operators

The basic arithmetic operators are given below.

Operator Meaning

∗ multiplication

/ Division

% Modulo division

Example 8

If a and b are two integers then:

a + b gives the sum of two integers a and b.

a * b gives their multiplication.

a / b gives the quotient when a is divided by b.

a % b gives the remainder when a is divided by b.

modulo division operator cannot be used on floating point data.

Example 9

Expressions

Any arrangement of variables, constants and operators that specifies a

computation is called an expression. Thus

Sum + I j+6 total/6 I + k*p height%22

are all examples of expressions. When computations specified in the

expressions are performed, the result is usually a value. Thus if the

values of Sum and I are 45 and 10 respectively, the value of that

expression is 55.

Parts of expressions may also be expressions. Even single variables and

constants, like total and 6, are considered to be expressions.

Note that expressions are not the same as statements. Statements tell the

compiler to do something and terminate with a semicolon, while

expressions specify a computation. There can be several expressions in a

statement.

Distance = (x1*x1 – y1*y1) + (x1*x1 – y1*y1) + val*654;

Integer arithmetic

When both the operands in a single arithmetic expressions such as a + b

are integers, the expression is called an integer expression. And

the operation is called integer arithmetic. Integer arithmetic

always gives integer value.

Real arithmetic

An arithmetic operation involving only real operands is called real

arithmetic. Since floating point values are rounded to the number of

significant digits permissible, the final values is an approximation of the

correct result.

Mixed-mode arithmetic

When one of the operands is real and the other is integer, the expression

is called a mixed-mode expression. If one of the operand is of the

real type, then only real operation is performed and the result is always a

real number.

Thus,

15/10.0 = 1.5

But

15/10 = 1

Relational operators

We often compare two quantities and depending on their values, take

certain decisions. These comparisons can be done with the help of

relational operators.

Operator Meaning

== is equal to

!= is not equal to

Logical operators

C++ has following logical operators.

Operator Meaning

|| Means logical OR

Assignment operators

Assignment operators are used to assign the result of an expression to

a variable. We have seen the usual assignment operator, =. In

addition, C++ has a set of shorthand assignment operators of the

form

variable operator = expression;

variable = variable operator expression;

Example 10

Increment and decrement operators

C++ allows two very useful operators. These are the increment and

decrement operators:

++ and --

The operator ++ adds 1 to the operand, while -- subtracts 1. Both are

unary operators and takes the following form:

++m; or m++;

--m; or --m;

++m or m++ is equivalent to m = m + 1;

--m or m-- is equivalent to m = m - 1;

While ++m and m++ mean the same thing when they form

statements independently, they behave differently when they are

used in expressions on the right-hand side of an assignment

statement.

Example 11

Increment and decrement operators are unary operators and they

require variables as their operands.

When postfix ++ (or --) is used with a variable in an expression, the

expression is evaluated first using the original value of the variable

and the variable is incremented(or decremented) by 1.

When prefix ++ (or --) is used with a variable in an expression, first

the variable is incremented(or decremented) by 1 and then the

expression is evaluated using the new value of the variable.

- OSS 2marks With AnswerUploaded bySiva Balan
- saxon 54 se 3eUploaded byapi-280917779
- Chapter 02-Computer ArithmeticUploaded byAbir Hossain
- Division StrategiesUploaded byTessa Lofthouse
- Vedic MathematicsUploaded byPrathik YR
- student teachingUploaded byapi-433362360
- Vedic Mathematics BOOK 1 pdf.pdfUploaded byJose Luis Suarez Fuentes
- Supporting your kids in Maths " Multiplication and DivisionUploaded by3218
- mms9 text 03 unit3Uploaded byapi-265180883
- Binary Conversion ExercisesUploaded byJason
- strengthsandweaknessesofthefilipinocharacter-120520082929-phpapp01Uploaded byEechram Chang Alolod
- A_New_System_of_Arithmetic_and_Mathematics_1000016571.pdfUploaded byRené Wester
- 6 Programming with MATLAB.pdfUploaded byAugusto De La Cruz Camayo
- 38848Uploaded byAbhilashPadmanabhan
- MATH103 Math for Todays WorldUploaded byalfredomedardo
- 05 01 02 Conditional Execution-Making Choices in Python VFUploaded byM Idrees
- MA1200 Chapter 3 Polynomials and Rational FunctionsUploaded byWai Ho Choi

- Practice SolutionsUploaded byKenny
- ACJC Promo PaperUploaded byMathathlete
- Emuneration Techniques_Gabriel CarrollUploaded byLiu Yi Jia
- Chap 10 Solutions Ex 10 4 Method Umer AsgharUploaded bySikandar Khan
- Intro to Continuum Mechanics - Raymond.pdfUploaded bySeth Ferrara
- State Space Multi-machineUploaded byRoger Oliveira
- grade 7 myp 2 solving equations 13fUploaded byapi-296039056
- BS111Dec 2008 (New Scheme)Uploaded bydawdda
- contoh rphUploaded byjoharnijohari_728612
- Historical Development of Algebra, Trigonometry and Solid GeometryUploaded byFroiland Sampiano
- Five Integer Number Algorithms To Solve Linear SystemsUploaded byAnonymous 0U9j6BLllB
- MIT2 25F13 Vector ProblemUploaded byIhab Omar
- Rancangan Pengajaran Tahunan Matematik Tingkatan 1 2012Uploaded bythaasha
- Is an Irrational Number a Real NumberUploaded bynishagoyal
- (Little Mathematics Library'',) A G Kurosh-Algebraic Equations of Arbitrary Degrees-MIR PUBLISHER (1977).pdfUploaded bypanditabupesh
- S. V. Astashkin- Interpolation of Positive Polylinear Operators in Calderon-Lozanovskii SpacesUploaded byJutyyy
- R. Gobel, S. Shelah and S.L. Wallutis- On universal and epi-universal locally nilpotent groupsUploaded byHmsdk
- Winter 2008 Pre-Camp Problem SetUploaded byryszard_lubicz
- cartan_e11_1Uploaded byDeepak Khurana
- Additional Mathematics Project Work 2015Uploaded byPusat Tuisyen Bestari Ilmu
- Microsoft Word - Chotu Session Algebra Instructor NotesUploaded byGoodone Thisone
- MohitUploaded byMohit
- Chapter 2 SolutionsUploaded byanon_378523415
- merged document 19Uploaded byapi-285463164
- es1 mathematics year overviewUploaded byapi-249015874
- S&S Lab 1 HandoutUploaded byZameer Hussain
- Geometric Representation of Square RootUploaded byKasi Rao.Jonnala
- First order differential equations Chapter 1.2Uploaded byYap Yih Shan
- 2nd Year Math Chap No.4 (Ex 4.4 , 4.5 ) 5Uploaded byRana Hassan Tariq
- Harry Lass Vector and Tensor Analysis 0Uploaded bygeorgos21