Skip to main content
Engineering LibreTexts

4: Data and Operators

  • Page ID
    10260
    • 4.1: Data Types in C++
      Our interactions (inputs and outputs) of a program are treated in many languages as a stream of bytes. These bytes represent data that can be interpreted as representing values that we understand. Additionally, within a program we process this data in various ways such as adding them up or sorting them. This data comes in different forms.
    • 4.2: Identifier Names
      Within programming a variety of items are given descriptive names to make the code more meaningful to us as humans. These names are called "Identifier Names". Constants, variables, type definitions, functions, etc. when declared or defined are identified by a name.
    • 4.3: Constants and Variables
      Various textbooks describe constants using different terminology. Added to the complexity are the explanations from various industry professionals will vary greatly. Let's see if we can clear it up. A constant is a data item whose value cannot change during the program's execution. Thus, as its name implies – their value is constant.
    • 4.4: Data Manipulation
      Single values by themselves are important; however we need a method of manipulating values (processing data). Scientists wanted an accurate machine for manipulating values. They wanted a machine to process numbers or calculate answers (that is compute the answer). Prior to 1950, dictionaries listed the definition of computers as " humans that do computations". Thus, all of the terminology for describing data manipulation is math oriented.
    • 4.5: Assignment Operator
      The assignment operator allows us to change the value of a modifiable data object (for beginning programmers this typically means a variable). It is associated with the concept of moving a value into the storage location (again usually a variable). Within C++ programming language the symbol used is the equal symbol. But bite your tongue, when you see the = symbol you need to start thinking: assignment.
    • 4.6: Arithmetric Operators
      This expression consists of one operator (addition) which has two operands. The first is represented by a variable named age and the second is a literal constant. If age had a value of 14 then the expression would evaluate (or be equal to) 15.
    • 4.7: Data Type Conversions
      Automatic conversion of a value from one data type to another by a programming language, without the programmer specifically doing so, is called implicit type conversion. It happens when ever a binary operator has two operands of different data types. Depending on the operator, one of the operands is going to be converted to the data type of the other. It could be promoted or demoted depending on the operator.
    • 4.8: Practice 3 Data and Operators