Back to Course

Introduction to C++

0% Complete
0/0 Steps
  1. C++: Basics
    5Topics
    |
    6 Quizzes
  2. C++: Compilation and Execution
    5Topics
    |
    6 Quizzes
  3. C++: Variables
    9Topics
    |
    10 Quizzes
  4. C++: Conditions Operators
    5Topics
    |
    6 Quizzes
  5. C++: Logical Operators
    3Topics
    |
    4 Quizzes
  6. C++: Loops and Errors
    8Topics
    |
    9 Quizzes
  7. C++: Vectors
    4Topics
    |
    3 Quizzes
Lesson 3, Topic 1
In Progress

C++: Introducing Variables

Yasin Cakal 5 Nov 2021
Lesson Progress
0% Complete

Till now, we have been writing one-sided programs where the program user is not involved. However, good programs require inputs from the user to give appropriate outputs. This is where the fun in programming begins!

When a user inputs some data, the computer needs a location to save the input data. We use variables to name the part of the computer’s memory that stores and saves the input data in a particular form. By this, we mean all data is taken from the user in a specific data type. Some examples of data types are:

  • bool: false/true values
  • string: a succession of characters
  • char: inidividual character
  • double: floating-point numbers
  • int: integers

Each names variable input by the user has to be put under a specific variable type depending upon the type of input you want to receive from the user. Each variable type requires a different size of the computer’s memory. Hence, setting a variable type passes information to the computer on how much memory to set aside for this variable.

Responses

Leave a Reply

%d bloggers like this: